Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci/ixgbe Fix VLAN hardware filter initialization. U...



details:   https://anonhg.NetBSD.org/src/rev/402951a796c1
branches:  trunk
changeset: 462128:402951a796c1
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jul 25 09:28:07 2019 +0000

description:
Fix VLAN hardware filter initialization. Use unsigned. Found by KUBSan.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  4 ++--
 sys/dev/pci/ixgbe/ixv.c   |  6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 0eeb79b87968 -r 402951a796c1 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Jul 25 09:01:56 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Jul 25 09:28:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.195 2019/07/25 09:01:56 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.196 2019/07/25 09:28:07 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -2427,7 +2427,7 @@
 
                idx = vlanidp->vid / 32;
                KASSERT(idx < IXGBE_VFTA_SIZE);
-               adapter->shadow_vfta[idx] |= 1 << vlanidp->vid % 32;
+               adapter->shadow_vfta[idx] |= (u32)1 << (vlanidp->vid % 32);
        }
        mutex_exit(ec->ec_lock);
        for (i = 0; i < IXGBE_VFTA_SIZE; i++)
diff -r 0eeb79b87968 -r 402951a796c1 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Thu Jul 25 09:01:56 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Thu Jul 25 09:28:07 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.122 2019/07/25 09:01:56 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.123 2019/07/25 09:28:07 msaitoh Exp $*/
 
 /******************************************************************************
 
@@ -1993,7 +1993,7 @@
 
                idx = vlanidp->vid / 32;
                KASSERT(idx < IXGBE_VFTA_SIZE);
-               adapter->shadow_vfta[idx] |= 1 << vlanidp->vid % 32;
+               adapter->shadow_vfta[idx] |= (u32)1 << (vlanidp->vid % 32);
        }
        mutex_exit(ec->ec_lock);
        
@@ -2012,7 +2012,7 @@
                 */
                for (int j = 0; j < 32; j++) {
                        retry = 0;
-                       if ((vfta & (1 << j)) == 0)
+                       if ((vfta & ((u32)1 << j)) == 0)
                                continue;
                        vid = (i * 32) + j;
                        



Home | Main Index | Thread Index | Old Index