git: 834227ba6e80 - main - LinuxKPI: add ether_addr_equal_unaligned()

Bjoern A. Zeeb bz at FreeBSD.org
Tue May 25 18:15:11 UTC 2021


The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=834227ba6e80dc0899d2372ae8986241f5658c4e

commit 834227ba6e80dc0899d2372ae8986241f5658c4e
Author:     Bjoern A. Zeeb <bz at FreeBSD.org>
AuthorDate: 2021-05-24 18:09:37 +0000
Commit:     Bjoern A. Zeeb <bz at FreeBSD.org>
CommitDate: 2021-05-25 18:01:47 +0000

    LinuxKPI: add ether_addr_equal_unaligned()
    
    Replace the implementation for ether_addr_equal() with
    ether_addr_equal_unaligned() and add a define for ether_addr_equal()
    pointing to the now ether_addr_equal_unaligned() implementation.
    This way ether_addr_equal_unaligned() cannot be broken by accident [1].
    
    Suggested by:   emaste [1]
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 weeks
    Reviewed by:    hselasky
    Differential Revision: https://reviews.freebsd.org/D30425
---
 sys/compat/linuxkpi/common/include/linux/etherdevice.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/etherdevice.h b/sys/compat/linuxkpi/common/include/linux/etherdevice.h
index 392f395a5feb..9062cd562347 100644
--- a/sys/compat/linuxkpi/common/include/linux/etherdevice.h
+++ b/sys/compat/linuxkpi/common/include/linux/etherdevice.h
@@ -82,10 +82,11 @@ ether_addr_copy(u8 * dst, const u8 * src)
 }
 
 static inline bool
-ether_addr_equal(const u8 *pa, const u8 *pb)
+ether_addr_equal_unaligned(const u8 *pa, const u8 *pb)
 {
 	return (memcmp(pa, pb, 6) == 0);
 }
+#define	ether_addr_equal(_pa, _pb)	ether_addr_equal_unaligned(_pa, _pb)
 
 static inline bool
 ether_addr_equal_64bits(const u8 *pa, const u8 *pb)


More information about the dev-commits-src-main mailing list