Skip to content

Commit f333195

Browse files
JoePerchestorvalds
authored andcommitted
checkpatch: don't test for prefer ether_addr_<foo>
< sigh > Comment these tests out. These are just too enticing to people that don't verify that both source and dest addresses really must be __aligned(2). It helps make Dan Carpenter happy too. Link: http://lkml.kernel.org/r/dc32ec66d24647f4cdf824c8dfbbc59aa7ce7b7d.1472665676.git.joe@perches.com Signed-off-by: Joe Perches <[email protected]> Cc: Dan Carpenter <[email protected]> Cc: Greg <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 08eb9b8 commit f333195

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

scripts/checkpatch.pl

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5554,46 +5554,46 @@ sub process {
55545554
}
55555555

55565556
# Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar)
5557-
if ($^V && $^V ge 5.10.0 &&
5558-
defined $stat &&
5559-
$stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5560-
if (WARN("PREFER_ETHER_ADDR_COPY",
5561-
"Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)\n" . "$here\n$stat\n") &&
5562-
$fix) {
5563-
$fixed[$fixlinenr] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_addr_copy($2, $7)/;
5564-
}
5565-
}
5557+
# if ($^V && $^V ge 5.10.0 &&
5558+
# defined $stat &&
5559+
# $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5560+
# if (WARN("PREFER_ETHER_ADDR_COPY",
5561+
# "Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)\n" . "$here\n$stat\n") &&
5562+
# $fix) {
5563+
# $fixed[$fixlinenr] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_addr_copy($2, $7)/;
5564+
# }
5565+
# }
55665566

55675567
# Check for memcmp(foo, bar, ETH_ALEN) that could be ether_addr_equal*(foo, bar)
5568-
if ($^V && $^V ge 5.10.0 &&
5569-
defined $stat &&
5570-
$stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5571-
WARN("PREFER_ETHER_ADDR_EQUAL",
5572-
"Prefer ether_addr_equal() or ether_addr_equal_unaligned() over memcmp()\n" . "$here\n$stat\n")
5573-
}
5568+
# if ($^V && $^V ge 5.10.0 &&
5569+
# defined $stat &&
5570+
# $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5571+
# WARN("PREFER_ETHER_ADDR_EQUAL",
5572+
# "Prefer ether_addr_equal() or ether_addr_equal_unaligned() over memcmp()\n" . "$here\n$stat\n")
5573+
# }
55745574

55755575
# check for memset(foo, 0x0, ETH_ALEN) that could be eth_zero_addr
55765576
# check for memset(foo, 0xFF, ETH_ALEN) that could be eth_broadcast_addr
5577-
if ($^V && $^V ge 5.10.0 &&
5578-
defined $stat &&
5579-
$stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5580-
5581-
my $ms_val = $7;
5582-
5583-
if ($ms_val =~ /^(?:0x|)0+$/i) {
5584-
if (WARN("PREFER_ETH_ZERO_ADDR",
5585-
"Prefer eth_zero_addr over memset()\n" . "$here\n$stat\n") &&
5586-
$fix) {
5587-
$fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_zero_addr($2)/;
5588-
}
5589-
} elsif ($ms_val =~ /^(?:0xff|255)$/i) {
5590-
if (WARN("PREFER_ETH_BROADCAST_ADDR",
5591-
"Prefer eth_broadcast_addr() over memset()\n" . "$here\n$stat\n") &&
5592-
$fix) {
5593-
$fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_broadcast_addr($2)/;
5594-
}
5595-
}
5596-
}
5577+
# if ($^V && $^V ge 5.10.0 &&
5578+
# defined $stat &&
5579+
# $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5580+
#
5581+
# my $ms_val = $7;
5582+
#
5583+
# if ($ms_val =~ /^(?:0x|)0+$/i) {
5584+
# if (WARN("PREFER_ETH_ZERO_ADDR",
5585+
# "Prefer eth_zero_addr over memset()\n" . "$here\n$stat\n") &&
5586+
# $fix) {
5587+
# $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_zero_addr($2)/;
5588+
# }
5589+
# } elsif ($ms_val =~ /^(?:0xff|255)$/i) {
5590+
# if (WARN("PREFER_ETH_BROADCAST_ADDR",
5591+
# "Prefer eth_broadcast_addr() over memset()\n" . "$here\n$stat\n") &&
5592+
# $fix) {
5593+
# $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_broadcast_addr($2)/;
5594+
# }
5595+
# }
5596+
# }
55975597

55985598
# typecasts on min/max could be min_t/max_t
55995599
if ($^V && $^V ge 5.10.0 &&

0 commit comments

Comments
 (0)