i40e: avoid potential null pointer dereference when assigning len
authorColin Ian King <colin.king@canonical.com>
Sun, 28 Aug 2016 17:41:01 +0000 (18:41 +0100)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 23 Sep 2016 05:33:40 +0000 (22:33 -0700)
commitff918912e1b8ba4e743d1f0b06ced1d01969e17c
tree1f51a4ce7333bc82853abb4e007154cfac57c7dc
parentb3f5c7bc88bab134e9649e42d30be15e3775f00d
i40e: avoid potential null pointer dereference when assigning len

There is a sanitcy check for desc being null in the first line of
function i40evf_debug_aq.  However, before that, aq_desc is cast from
desc, and aq_desc is being dereferenced on the assignment of len, so
this could be a potential null pointer deference.  Fix this by moving
the initialization of len to the code block where len is being used
and hence at this point we know it is OK to dereference aq_desc.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40evf/i40e_common.c