From: Joe Perches <joe@perches.com>
To: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Cc: apw@canonical.com, davem@davemloft.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] checkpatch: suggest using eth_zero_addr() and eth_broadcast_addr()
Date: Sun, 19 Apr 2015 13:20:13 -0700 [thread overview]
Message-ID: <1429474813.2947.34.camel@perches.com> (raw)
In-Reply-To: <1429470246-15988-3-git-send-email-mateusz.kulikowski@gmail.com>
On Sun, 2015-04-19 at 21:04 +0200, Mateusz Kulikowski wrote:
> Suggest using eth_zero_addr() or eth_broadcast_addr() if memset is used instead.
Hi Mateusz, this is OK but here are some notes:
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -5042,6 +5042,22 @@ sub process {
[]
> +# check for memset(foo, 0x0, ETH_ALEN) that could be eth_zero_addr
> +# check for memset(foo, 0xFF, ETH_ALEN) that could be eth_broadcast_addr
> + if ($^V && $^V ge 5.10.0 &&
> + $line =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/s) {
Please align the $line with the $^V above it.
> +
> + my $ms_val = $7;
> +
> + if ($ms_val =~ /^(0x|)0$/i) {
I've seen 0x00 many times so: /^(?:0x|)0+$/
> + WARN("PREFER_ETH_ZERO_ADDR",
> + "Prefer eth_zero_addr over memset()\n" . $herecurr);
Please align to the initial open quote here:
WARN("PREFER_ETH_ZERO_ADDR",
"Prefer eth_zero_addr over memset()\n" . $herecurr);
> + } elsif ($ms_val =~ /^0xff$/i) {
255 here too so: /^(?:0xff|255)$/
> + WARN("PREFER_ETH_BROADCAST_ADDR",
> + "Prefer eth_broadcast_addr() over memset()\n" . $herecurr);
Please align to open quote
next prev parent reply other threads:[~2015-04-19 20:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-19 19:04 [PATCH 0/2] checkpatch: new ethernet address manipulation checks Mateusz Kulikowski
2015-04-19 19:04 ` [PATCH 1/2] checkpatch: suggest using ether_addr_equal*() Mateusz Kulikowski
2015-04-19 20:23 ` Joe Perches
2015-04-19 19:04 ` [PATCH 2/2] checkpatch: suggest using eth_zero_addr() and eth_broadcast_addr() Mateusz Kulikowski
2015-04-19 20:20 ` Joe Perches [this message]
2015-04-19 22:01 ` Mateusz Kulikowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429474813.2947.34.camel@perches.com \
--to=joe@perches.com \
--cc=apw@canonical.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mateusz.kulikowski@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.