Patchwork [net-next,11/15] ixgbe: fix potential null dereference

login
register
mail settings
Submitter Jeff Kirsher
Date Feb. 5, 2013, 10:02 a.m.
Message ID <1360058548-18158-12-git-send-email-jeffrey.t.kirsher@intel.com>
Download mbox | patch
Permalink /patch/218208/
State Accepted
Delegated to: David Miller
Headers show

Comments

Jeff Kirsher - Feb. 5, 2013, 10:02 a.m.
From: Josh Hay <joshua.a.hay@intel.com>

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 | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 216203e..bafd141 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -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 ==