git: 6fb0634bc4ce - stable/14 - linuxkpi: use canonical tests for is_{zero,broadcast}_ether_addr
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 11 Aug 2024 23:03:02 UTC
The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6fb0634bc4ce5fe32312a53031e56fe866b0b24d commit 6fb0634bc4ce5fe32312a53031e56fe866b0b24d Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2024-08-08 00:00:00 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-08-11 23:01:51 +0000 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 (cherry picked from commit a1295b24842d209e6bf93a4823193d56ad2db064) --- sys/compat/linuxkpi/common/include/linux/etherdevice.h | 6 ++++-- 1 file 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