i40evf: ethtool RSS fixes
authorMitch Williams <mitch.a.williams@intel.com>
Tue, 24 Feb 2015 06:58:51 +0000 (06:58 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 3 Mar 2015 09:07:29 +0000 (01:07 -0800)
Add an extra check to make sure that the indirection table pointer is
valid before dereferencing it.

Change-ID: I698adbf3daff03081d01f489dc95a9f1ad8b12f1
Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c

index c5ffaccb59d3c825494c998dd687b48d5f389bdd..681a5d4b4f6ae505c9a64fdc9182259b0a48ce28 100644 (file)
@@ -642,12 +642,14 @@ static int i40evf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
        if (!indir)
                return 0;
 
-       for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
-               hlut_val = rd32(hw, I40E_VFQF_HLUT(i));
-               indir[j++] = hlut_val & 0xff;
-               indir[j++] = (hlut_val >> 8) & 0xff;
-               indir[j++] = (hlut_val >> 16) & 0xff;
-               indir[j++] = (hlut_val >> 24) & 0xff;
+       if (indir) {
+               for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
+                       hlut_val = rd32(hw, I40E_VFQF_HLUT(i));
+                       indir[j++] = hlut_val & 0xff;
+                       indir[j++] = (hlut_val >> 8) & 0xff;
+                       indir[j++] = (hlut_val >> 16) & 0xff;
+                       indir[j++] = (hlut_val >> 24) & 0xff;
+               }
        }
        return 0;
 }