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 CID/1008347, CID/1008348, CID/1008349: ov...



details:   https://anonhg.NetBSD.org/src/rev/9a32e8a44cea
branches:  trunk
changeset: 328770:9a32e8a44cea
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 17 16:22:48 2014 +0000

description:
CID/1008347, CID/1008348, CID/1008349:  overflow before widen
CID/1203198, CID/1203199:  Uninitialized scalar variable

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c        |  18 +++++++++++-------
 sys/dev/pci/ixgbe/ixgbe_netbsd.h |   3 +--
 2 files changed, 12 insertions(+), 9 deletions(-)

diffs (87 lines):

diff -r 2078aa5ce90b -r 9a32e8a44cea sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Apr 17 16:14:22 2014 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Apr 17 16:22:48 2014 +0000
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe.c,v 1.51 2011/04/25 23:34:21 jfv Exp $*/
-/*$NetBSD: ixgbe.c,v 1.12 2014/04/15 12:37:59 hannken Exp $*/
+/*$NetBSD: ixgbe.c,v 1.13 2014/04/17 16:22:48 christos Exp $*/
 
 #include "opt_inet.h"
 
@@ -1378,7 +1378,7 @@
 ixgbe_enable_queue(struct adapter *adapter, u32 vector)
 {
        struct ixgbe_hw *hw = &adapter->hw;
-       u64     queue = (u64)(1 << vector);
+       u64     queue = (u64)(1ULL << vector);
        u32     mask;
 
        if (hw->mac.type == ixgbe_mac_82598EB) {
@@ -1398,7 +1398,7 @@
 ixgbe_disable_queue(struct adapter *adapter, u32 vector)
 {
        struct ixgbe_hw *hw = &adapter->hw;
-       u64     queue = (u64)(1 << vector);
+       u64     queue = (u64)(1ULL << vector);
        u32     mask;
 
        if (hw->mac.type == ixgbe_mac_82598EB) {
@@ -2725,6 +2725,8 @@
                if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
                        err  = hw->mac.ops.get_link_capabilities(hw,
                            &autoneg, &negotiate);
+               else
+                       negotiate = 0;
                if (err)
                        goto out;
                if (hw->mac.ops.setup_link)
@@ -4649,7 +4651,7 @@
        ** Schedule another interrupt if so.
        */
        if ((staterr & IXGBE_RXD_STAT_DD) != 0) {
-               ixgbe_rearm_queues(adapter, (u64)(1 << que->msix));
+               ixgbe_rearm_queues(adapter, (u64)(1ULL << que->msix));
                return true;
        }
 
@@ -5020,9 +5022,9 @@
 {
        struct adapter  *adapter = context;
 
-       ixgbe_check_link(&adapter->hw,
-           &adapter->link_speed, &adapter->link_up, 0);
-               ixgbe_update_link_status(adapter);
+       if (ixgbe_check_link(&adapter->hw,
+           &adapter->link_speed, &adapter->link_up, 0) == 0)
+           ixgbe_update_link_status(adapter);
 }
 
 /*
@@ -5067,6 +5069,8 @@
        autoneg = hw->phy.autoneg_advertised;
        if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
                hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiate);
+       else
+               negotiate = 0;
        if (hw->mac.ops.setup_link)
                hw->mac.ops.setup_link(hw, autoneg, negotiate, TRUE);
        return;
diff -r 2078aa5ce90b -r 9a32e8a44cea sys/dev/pci/ixgbe/ixgbe_netbsd.h
--- a/sys/dev/pci/ixgbe/ixgbe_netbsd.h  Thu Apr 17 16:14:22 2014 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_netbsd.h  Thu Apr 17 16:22:48 2014 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixgbe_netbsd.h,v 1.1 2011/08/12 21:55:29 dyoung Exp $*/
+/*$NetBSD: ixgbe_netbsd.h,v 1.2 2014/04/17 16:22:48 christos Exp $*/
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,6 @@
 
 #define        ETHERCAP_VLAN_HWFILTER  0
 #define        ETHERCAP_VLAN_HWCSUM    0
-#define        IFCAP_LRO               0
 #define        MJUM9BYTES      (9 * 1024)
 #define        MJUM16BYTES     (16 * 1024)
 #define        MJUMPAGESIZE    PAGE_SIZE



Home | Main Index | Thread Index | Old Index