From: Ying Xue <ying.xue@windriver.com>
To: Huang Guobin <huangguobin4@huawei.com>,
jmaloy@redhat.com, davem@davemloft.net, kuba@kernel.org
Cc: netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] tipc: Use is_broadcast_ether_addr() instead of memcmp()
Date: Mon, 3 Aug 2020 21:51:45 +0800 [thread overview]
Message-ID: <d8491b36-d81b-c2e8-de04-fd1c4a1254ba@windriver.com> (raw)
In-Reply-To: <20200803020055.26822-1-huangguobin4@huawei.com>
On 8/3/20 10:00 AM, Huang Guobin wrote:
> Using is_broadcast_ether_addr() instead of directly use
> memcmp() to determine if the ethernet address is broadcast
> address.
>
> spatch with a semantic match is used to found this problem.
> (http://coccinelle.lip6.fr/)
>
> Signed-off-by: Huang Guobin <huangguobin4@huawei.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
> ---
> net/tipc/eth_media.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
> index 8b0bb600602d..c68019697cfe 100644
> --- a/net/tipc/eth_media.c
> +++ b/net/tipc/eth_media.c
> @@ -62,12 +62,10 @@ static int tipc_eth_raw2addr(struct tipc_bearer *b,
> struct tipc_media_addr *addr,
> char *msg)
> {
> - char bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
> -
> memset(addr, 0, sizeof(*addr));
> ether_addr_copy(addr->value, msg);
> addr->media_id = TIPC_MEDIA_TYPE_ETH;
> - addr->broadcast = !memcmp(addr->value, bcast_mac, ETH_ALEN);
> + addr->broadcast = is_broadcast_ether_addr(addr->value);
> return 0;
> }
>
>
next prev parent reply other threads:[~2020-08-03 14:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 2:00 [PATCH net-next] tipc: Use is_broadcast_ether_addr() instead of memcmp() Huang Guobin
2020-08-03 13:51 ` Ying Xue [this message]
2020-08-03 23:22 ` David Miller
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=d8491b36-d81b-c2e8-de04-fd1c4a1254ba@windriver.com \
--to=ying.xue@windriver.com \
--cc=davem@davemloft.net \
--cc=huangguobin4@huawei.com \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox