diff options
author | Ed Maste <emaste@FreeBSD.org> | 2024-08-08 00:00:00 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2024-08-08 16:39:14 +0000 |
commit | a1295b24842d209e6bf93a4823193d56ad2db064 (patch) | |
tree | dd1769751fcf3ff0236cf1b99ee499d95a53b92e /sys/compat/linuxkpi/common | |
parent | 57cc80e6e39ecef3d11b7a787866f79ad1310da1 (diff) | |
download | src-a1295b24842d209e6bf93a4823193d56ad2db064.tar.gz src-a1295b24842d209e6bf93a4823193d56ad2db064.zip |
linuxkpi: use canonical tests for is_{zero,broadcast}_ether_addr
They are functionally equivalent, but the updated form mirrors the tests
in sys/net/ethernet.h and avoids confusion.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21037
Diffstat (limited to 'sys/compat/linuxkpi/common')
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/etherdevice.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/etherdevice.h b/sys/compat/linuxkpi/common/include/linux/etherdevice.h index 89cd4c8e0ba0..5d3df744ae0e 100644 --- a/sys/compat/linuxkpi/common/include/linux/etherdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/etherdevice.h @@ -53,7 +53,8 @@ struct ethtool_modinfo { static inline bool is_zero_ether_addr(const u8 * addr) { - return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == 0x00); + return ((addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]) == + 0x00); } static inline bool @@ -65,7 +66,8 @@ is_multicast_ether_addr(const u8 * addr) static inline bool is_broadcast_ether_addr(const u8 * addr) { - return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == (6 * 0xff)); + return ((addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == + 0xff); } static inline bool |