Commit fbc97de8 authored by Huang Guobin's avatar Huang Guobin Committed by David S. Miller

tipc: Use is_broadcast_ether_addr() instead of memcmp()

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: default avatarHuang Guobin <huangguobin4@huawei.com>
Acked-by: default avatarYing Xue <ying.xue@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6c09b484
...@@ -62,12 +62,10 @@ static int tipc_eth_raw2addr(struct tipc_bearer *b, ...@@ -62,12 +62,10 @@ static int tipc_eth_raw2addr(struct tipc_bearer *b,
struct tipc_media_addr *addr, struct tipc_media_addr *addr,
char *msg) char *msg)
{ {
char bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
memset(addr, 0, sizeof(*addr)); memset(addr, 0, sizeof(*addr));
ether_addr_copy(addr->value, msg); ether_addr_copy(addr->value, msg);
addr->media_id = TIPC_MEDIA_TYPE_ETH; 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment