[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1429470246-15988-2-git-send-email-mateusz.kulikowski@gmail.com>
Date: Sun, 19 Apr 2015 21:04:05 +0200
From: Mateusz Kulikowski <mateusz.kulikowski@...il.com>
To: joe@...ches.com, apw@...onical.com
Cc: Mateusz Kulikowski <mateusz.kulikowski@...il.com>,
davem@...emloft.net, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] 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@...il.com>
---
scripts/checkpatch.pl | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 89b1df4..3a1a01e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5035,6 +5035,13 @@ sub process {
}
}
+# Check for memcmp(foo, bar, ETH_ALEN) that could be ether_addr_equal*(foo, bar)
+ if ($^V && $^V ge 5.10.0 &&
+ $line =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/s) {
+ WARN("PREFER_ETHER_ADDR_EQUAL",
+ "Prefer ether_addr_equal() or ether_addr_equal_unaligned() over memcmp()\n" . $herecurr)
+ }
+
# typecasts on min/max could be min_t/max_t
if ($^V && $^V ge 5.10.0 &&
defined $stat &&
--
1.8.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists