]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
tipc: Use is_broadcast_ether_addr() instead of memcmp()
authorHuang Guobin <huangguobin4@huawei.com>
Mon, 3 Aug 2020 02:00:55 +0000 (22:00 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Aug 2020 23:21:46 +0000 (16:21 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/eth_media.c

index 8b0bb600602de5f3cc1dfc76b116666820461b51..c68019697cfe1d55e252dc318a1eb0597f9f46a0 100644 (file)
@@ -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;
 }