diff options
author | Shannon Nelson <shannon.nelson@intel.com> | 2014-11-13 08:23:16 +0000 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2014-12-09 12:57:02 -0800 |
commit | 43477d2bbf2e0beabce94e6d99ebb5b3c648aaf4 (patch) | |
tree | aba1797168e46886e0b9aa665ed306994a3e2fb7 /drivers/net/ethernet | |
parent | 74d0d0ede7c96cbb4cb9b5fa755419e336ba6451 (diff) |
i40e: add range check to i40e_aq_rc_to_posix
Just to be sure, add a range check to avoid any possible
array index-out-of-bound issues.
CC: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Change-ID: I9323bee6732c2a47599816e1d6c6b3a1f8dcbf54
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Acked-by: Michal Kosiarz <michal.kosiarz@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40evf/i40e_adminq.h | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h b/drivers/net/ethernet/intel/i40e/i40e_adminq.h index 618fe9623b6..2c68bf7ccd1 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h @@ -136,6 +136,8 @@ static inline int i40e_aq_rc_to_posix(u16 aq_rc) -EFBIG, /* I40E_AQ_RC_EFBIG */ }; + if (aq_rc >= ARRAY_SIZE(aq_to_posix)) + return -ERANGE; return aq_to_posix[aq_rc]; } diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq.h b/drivers/net/ethernet/intel/i40evf/i40e_adminq.h index d5d3c9310d2..0ffb8d16c63 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_adminq.h +++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq.h @@ -136,6 +136,8 @@ static inline int i40e_aq_rc_to_posix(u16 aq_rc) -EFBIG, /* I40E_AQ_RC_EFBIG */ }; + if (aq_rc >= ARRAY_SIZE(aq_to_posix)) + return -ERANGE; return aq_to_posix[aq_rc]; } |