Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Use unsigned in rtk_setmulti() to avoid undefined...



details:   https://anonhg.NetBSD.org/src/rev/052bb3f695cf
branches:  trunk
changeset: 458579:052bb3f695cf
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Aug 01 15:21:50 2019 +0000

description:
Use unsigned in rtk_setmulti() to avoid undefined behavoir. Found bk kUBSan.

diffstat:

 sys/dev/ic/rtl81x9.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r ae57909cae21 -r 052bb3f695cf sys/dev/ic/rtl81x9.c
--- a/sys/dev/ic/rtl81x9.c      Thu Aug 01 15:21:09 2019 +0000
+++ b/sys/dev/ic/rtl81x9.c      Thu Aug 01 15:21:50 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtl81x9.c,v 1.106 2019/05/28 07:41:48 msaitoh Exp $    */
+/*     $NetBSD: rtl81x9.c,v 1.107 2019/08/01 15:21:50 msaitoh Exp $    */
 
 /*
  * Copyright (c) 1997, 1998
@@ -86,7 +86,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.106 2019/05/28 07:41:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.107 2019/08/01 15:21:50 msaitoh Exp $");
 
 
 #include <sys/param.h>
@@ -561,9 +561,9 @@
 
                h = rtk_calchash(enm->enm_addrlo);
                if (h < 32)
-                       hashes[0] |= (1 << h);
+                       hashes[0] |= __BIT(h);
                else
-                       hashes[1] |= (1 << (h - 32));
+                       hashes[1] |= __BIT(h - 32);
                mcnt++;
                ETHER_NEXT_MULTI(step, enm);
        }



Home | Main Index | Thread Index | Old Index