]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
i40e: add range check to i40e_aq_rc_to_posix
authorShannon Nelson <shannon.nelson@intel.com>
Thu, 13 Nov 2014 08:23:16 +0000 (08:23 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 9 Dec 2014 20:57:02 +0000 (12:57 -0800)
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>
drivers/net/ethernet/intel/i40e/i40e_adminq.h
drivers/net/ethernet/intel/i40evf/i40e_adminq.h

index 618fe9623b6d15842efada93fcc86a59bb47736c..2c68bf7ccd1e8abf5cf0115562aec5a17c0ac0cb 100644 (file)
@@ -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];
 }
 
index d5d3c9310d2d47dbdf07f8c878ce724c38a20ea2..0ffb8d16c63a38fd78c9cb5ce6cd0fc1719ec67b 100644 (file)
@@ -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];
 }