]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ixgbevf: Correct parameter sent to LED function
authorDon Skidmore <donald.c.skidmore@intel.com>
Fri, 17 Jun 2016 21:10:13 +0000 (17:10 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 22 Jul 2016 08:12:58 +0000 (01:12 -0700)
The second parameter of these functions is the index to the led we
are interested in affecting.  However we were mistakenly passing
the offset in the register.  This patch corrects that and adds some
bonds checking which would hopefully make bugs like this more noticeable
in the future.

Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

index 902d2061ce73a32e44e7a48a1547f0c8205ba9a4..0ffba44582458529173b6179952d030b6f393856 100644 (file)
@@ -763,6 +763,9 @@ s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index)
 {
        u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
 
+       if (index > 3)
+               return IXGBE_ERR_PARAM;
+
        /* To turn on the LED, set mode to ON. */
        led_reg &= ~IXGBE_LED_MODE_MASK(index);
        led_reg |= IXGBE_LED_ON << IXGBE_LED_MODE_SHIFT(index);
@@ -781,6 +784,9 @@ s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index)
 {
        u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
 
+       if (index > 3)
+               return IXGBE_ERR_PARAM;
+
        /* To turn off the LED, set mode to OFF. */
        led_reg &= ~IXGBE_LED_MODE_MASK(index);
        led_reg |= IXGBE_LED_OFF << IXGBE_LED_MODE_SHIFT(index);
@@ -2698,6 +2704,9 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
        bool locked = false;
        s32 ret_val;
 
+       if (index > 3)
+               return IXGBE_ERR_PARAM;
+
        /*
         * Link must be up to auto-blink the LEDs;
         * Force it if link is down.
@@ -2741,6 +2750,9 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index)
        bool locked = false;
        s32 ret_val;
 
+       if (index > 3)
+               return IXGBE_ERR_PARAM;
+
        ret_val = hw->mac.ops.prot_autoc_read(hw, &locked, &autoc_reg);
        if (ret_val)
                return ret_val;
index 8a8450788124da0c81bf8519afc7a7aae3d89da7..0d7209eb5abfd4e71636b932176f17a98f822293 100644 (file)
@@ -2204,11 +2204,11 @@ static int ixgbe_set_phys_id(struct net_device *netdev,
                return 2;
 
        case ETHTOOL_ID_ON:
-               hw->mac.ops.led_on(hw, IXGBE_LED_ON);
+               hw->mac.ops.led_on(hw, hw->bus.func);
                break;
 
        case ETHTOOL_ID_OFF:
-               hw->mac.ops.led_off(hw, IXGBE_LED_ON);
+               hw->mac.ops.led_off(hw, hw->bus.func);
                break;
 
        case ETHTOOL_ID_INACTIVE: