[PATCH] e1000: avoid null pointer dereference on invalid stat type

2017-09-21 Thread Colin King
From: Colin Ian King Currently if the stat type is invalid then data[i] is being set either by dereferencing a null pointer p, or it is reading from an incorrect previous location if we had a valid stat type previously. Fix this by nullify pointer p if a stat type is invalid and only setting dat

Re: [PATCH] e1000: avoid null pointer dereference on invalid stat type

2017-09-22 Thread Dan Carpenter
On Thu, Sep 21, 2017 at 11:01:58PM +0100, Colin King wrote: > @@ -1837,12 +1838,13 @@ static void e1000_get_ethtool_stats(struct net_device > *netdev, > p = (char *)adapter + stat->stat_offset; > break; > default: > + p

Re: [PATCH] e1000: avoid null pointer dereference on invalid stat type

2017-09-22 Thread Colin Ian King
On 22/09/17 12:50, Dan Carpenter wrote: > On Thu, Sep 21, 2017 at 11:01:58PM +0100, Colin King wrote: >> @@ -1837,12 +1838,13 @@ static void e1000_get_ethtool_stats(struct >> net_device *netdev, >> p = (char *)adapter + stat->stat_offset; >> break; >>