ixgbe: fix potential null dereference
authorJosh Hay <joshua.a.hay@intel.com>
Fri, 4 Jan 2013 03:34:36 +0000 (03:34 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 5 Feb 2013 09:43:49 +0000 (01:43 -0800)
This patch adds a default case which goes to the next loop iteration
in the case where p is not set, preventing p from being dereferenced.

Signed-off-by: Josh Hay <joshua.a.hay@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

index 216203ece6ed2dfedc8fe2510833b1e5feabbd45..bafd141193af2ad5db16ebdb1d0864e5b420f049 100644 (file)
@@ -1040,6 +1040,9 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
                        p = (char *) adapter +
                                        ixgbe_gstrings_stats[i].stat_offset;
                        break;
+               default:
+                       data[i] = 0;
+                       continue;
                }
 
                data[i] = (ixgbe_gstrings_stats[i].sizeof_stat ==