Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Use unsigned to avoid undefined behavior in lii_...



details:   https://anonhg.NetBSD.org/src/rev/6826f18adafb
branches:  trunk
changeset: 965462:6826f18adafb
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Sep 18 00:09:42 2019 +0000

description:
Use unsigned to avoid undefined behavior in lii_setmulti().

diffstat:

 sys/dev/pci/if_lii.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 6d1bfe572679 -r 6826f18adafb sys/dev/pci/if_lii.c
--- a/sys/dev/pci/if_lii.c      Tue Sep 17 15:20:05 2019 +0000
+++ b/sys/dev/pci/if_lii.c      Wed Sep 18 00:09:42 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_lii.c,v 1.26 2019/05/30 02:32:18 msaitoh Exp $      */
+/*     $NetBSD: if_lii.c,v 1.27 2019/09/18 00:09:42 msaitoh Exp $      */
 
 /*
  *  Copyright (c) 2008 The NetBSD Foundation.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.26 2019/05/30 02:32:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.27 2019/09/18 00:09:42 msaitoh Exp $");
 
 
 #include <sys/param.h>
@@ -1186,10 +1186,10 @@
 
                crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
 
-               if (crc & (1 << 31))
-                       mht1 |= (1 << ((crc >> 26) & 0x0000001f));
+               if (crc & (1U << 31))
+                       mht1 |= (1U << ((crc >> 26) & 0x0000001f));
                else
-                       mht0 |= (1 << ((crc >> 26) & 0x0000001f));
+                       mht0 |= (1U << ((crc >> 26) & 0x0000001f));
 
             ETHER_NEXT_MULTI(step, enm);
        }



Home | Main Index | Thread Index | Old Index