Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Calculate the multicast hash table correctly to ...



details:   https://anonhg.NetBSD.org/src/rev/abadcf35432d
branches:  trunk
changeset: 842866:abadcf35432d
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Jul 26 05:53:30 2019 +0000

description:
Calculate the multicast hash table correctly to avoid undefined behavior.
Found by KUBSan.

diffstat:

 sys/dev/pci/if_bnx.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 11ebd3e7fbea -r abadcf35432d sys/dev/pci/if_bnx.c
--- a/sys/dev/pci/if_bnx.c      Fri Jul 26 05:39:55 2019 +0000
+++ b/sys/dev/pci/if_bnx.c      Fri Jul 26 05:53:30 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bnx.c,v 1.86 2019/07/09 08:46:59 msaitoh Exp $      */
+/*     $NetBSD: if_bnx.c,v 1.87 2019/07/26 05:53:30 msaitoh Exp $      */
 /*     $OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $       */
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.86 2019/07/09 08:46:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.87 2019/07/26 05:53:30 msaitoh Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -5631,7 +5631,7 @@
                        }
                        h = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN) &
                            0xFF;
-                       hashes[(h & 0xE0) >> 5] |= 1 << (h & 0x1F);
+                       hashes[(h & 0xE0) >> 5] |= __BIT(h & 0x1F);
                        ETHER_NEXT_MULTI(step, enm);
                }
                ETHER_UNLOCK(ec);



Home | Main Index | Thread Index | Old Index