diff options
author | Mateusz Kulikowski <mateusz.kulikowski@gmail.com> | 2015-06-25 15:03:13 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-25 17:00:42 -0700 |
commit | b6117d175be9972fc300f826e6f2bf9c589e0919 (patch) | |
tree | de2fc88e4163194fb3c30941ac7762ae7f084411 /scripts | |
parent | 06330fc40e3f3034de4934ec347604b5e36c40c3 (diff) |
checkpatch: suggest using ether_addr_equal*()
Check if memcmp() is used to compare ethernet addresses and suggest using
ether_addr_equal() or ether_addr_equal_unaligned()
Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Acked-by: Joe Perches <joe@perches.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 69c4716d9e27..f04fe88d998d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5157,6 +5157,14 @@ sub process { } } +# Check for memcmp(foo, bar, ETH_ALEN) that could be ether_addr_equal*(foo, bar) + if ($^V && $^V ge 5.10.0 && + defined $stat && + $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { + WARN("PREFER_ETHER_ADDR_EQUAL", + "Prefer ether_addr_equal() or ether_addr_equal_unaligned() over memcmp()\n" . "$here\n$stat\n") + } + # typecasts on min/max could be min_t/max_t if ($^V && $^V ge 5.10.0 && defined $stat && |