]> git.baikalelectronics.ru Git - kernel.git/commit
e1000: avoid null pointer dereference on invalid stat type
authorColin Ian King <colin.king@canonical.com>
Fri, 22 Sep 2017 17:13:48 +0000 (18:13 +0100)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 26 Oct 2017 14:42:57 +0000 (07:42 -0700)
commit6b33b25ab8edd2a5d44f2fd870d3ae680e5c61b5
tree5616315998d55a61a9f5c60fcc2951c864c8f4f3
parentcaa0377dcd39100071be3a13a6a2dfb07055fd58
e1000: avoid null pointer dereference on invalid stat type

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 skipping over the read of p on an invalid
stat type.

Detected by CoverityScan, CID#113385 ("Explicit null dereferenced")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/e1000/e1000_ethtool.c