Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Avoid undefined behavior when setting multicast a...



details:   https://anonhg.NetBSD.org/src/rev/275add36dc7e
branches:  trunk
changeset: 458530:275add36dc7e
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Jul 30 16:49:20 2019 +0000

description:
Avoid undefined behavior when setting multicast address. found by kUBSan.

diffstat:

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

diffs (27 lines):

diff -r 57b454493f6a -r 275add36dc7e sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c        Tue Jul 30 16:07:04 2019 +0000
+++ b/sys/dev/ic/tulip.c        Tue Jul 30 16:49:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tulip.c,v 1.197 2019/05/28 08:59:34 msaitoh Exp $      */
+/*     $NetBSD: tulip.c,v 1.198 2019/07/30 16:49:20 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.197 2019/05/28 08:59:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.198 2019/07/30 16:49:20 msaitoh Exp $");
 
 
 #include <sys/param.h>
@@ -2943,7 +2943,7 @@
                }
 
                hash = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN) & 0x3f;
-               mchash[hash >> 5] |= 1 << (hash & 0x1f);
+               mchash[hash >> 5] |= __BIT(hash & 0x1f);
                ETHER_NEXT_MULTI(step, enm);
        }
        ETHER_UNLOCK(ec);



Home | Main Index | Thread Index | Old Index