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 filter setting. Found by KUBSan.



details:   https://anonhg.NetBSD.org/src/rev/25574332dfa0
branches:  trunk
changeset: 1000457:25574332dfa0
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jul 25 09:01:56 2019 +0000

description:
Fix VLAN filter setting. Found by KUBSan.

diffstat:

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

diffs (72 lines):

diff -r 6c79c3883fe6 -r 25574332dfa0 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Jul 25 08:59:32 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Jul 25 09:01:56 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.194 2019/07/24 06:07:57 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.195 2019/07/25 09:01:56 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -2339,7 +2339,7 @@
        IXGBE_CORE_LOCK(adapter);
        index = (vtag >> 5) & 0x7F;
        bit = vtag & 0x1F;
-       adapter->shadow_vfta[index] |= (1 << bit);
+       adapter->shadow_vfta[index] |= ((u32)1 << bit);
        error = adapter->hw.mac.ops.set_vfta(&adapter->hw, vtag, 0, true,
            true);
        IXGBE_CORE_UNLOCK(adapter);
@@ -2370,7 +2370,7 @@
        IXGBE_CORE_LOCK(adapter);
        index = (vtag >> 5) & 0x7F;
        bit = vtag & 0x1F;
-       adapter->shadow_vfta[index] &= ~(1 << bit);
+       adapter->shadow_vfta[index] &= ~((u32)1 << bit);
        error = adapter->hw.mac.ops.set_vfta(&adapter->hw, vtag, 0, false,
            true);
        IXGBE_CORE_UNLOCK(adapter);
diff -r 6c79c3883fe6 -r 25574332dfa0 sys/dev/pci/ixgbe/ixgbe_common.c
--- a/sys/dev/pci/ixgbe/ixgbe_common.c  Thu Jul 25 08:59:32 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_common.c  Thu Jul 25 09:01:56 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.24 2019/07/25 07:05:44 msaitoh Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.25 2019/07/25 09:01:56 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -4020,7 +4020,7 @@
         *    bits[4-0]:  which bit in the register
         */
        regidx = vlan / 32;
-       vfta_delta = 1 << (vlan % 32);
+       vfta_delta = (u32)1 << (vlan % 32);
        vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(regidx));
 
        /*
diff -r 6c79c3883fe6 -r 25574332dfa0 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Thu Jul 25 08:59:32 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Thu Jul 25 09:01:56 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.121 2019/07/25 05:58:25 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.122 2019/07/25 09:01:56 msaitoh Exp $*/
 
 /******************************************************************************
 
@@ -2074,7 +2074,7 @@
        IXGBE_CORE_LOCK(adapter);
        index = (vtag >> 5) & 0x7F;
        bit = vtag & 0x1F;
-       adapter->shadow_vfta[index] |= (1 << bit);
+       adapter->shadow_vfta[index] |= ((u32)1 << bit);
        error = hw->mac.ops.set_vfta(hw, vtag, 0, true, false);
        IXGBE_CORE_UNLOCK(adapter);
 
@@ -2109,7 +2109,7 @@
        IXGBE_CORE_LOCK(adapter);
        index = (vtag >> 5) & 0x7F;
        bit = vtag & 0x1F;
-       adapter->shadow_vfta[index] &= ~(1 << bit);
+       adapter->shadow_vfta[index] &= ~((u32)1 << bit);
        error = hw->mac.ops.set_vfta(hw, vtag, 0, false, false);
        IXGBE_CORE_UNLOCK(adapter);
 



Home | Main Index | Thread Index | Old Index