Skip to content

Commit 1e99854

Browse files
msudheer337Jeff Kirsher
authored andcommitted
i40e: Fix potential out of bound array access
This is a fix for the static code analysis issue where dcbcfg->numapps could be greater than size of array (i.e dcbcfg->app[I40E_DCBX_MAX_APPS]). The fix makes sure that the array is not accessed past the size of of the array (i.e. I40E_DCBX_MAX_APPS). Copyright updated to 2017. Signed-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 15d23b4 commit 1e99854

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/intel/i40e/i40e_dcb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
*
33
* Intel Ethernet Controller XL710 Family Linux Driver
4-
* Copyright(c) 2013 - 2014 Intel Corporation.
4+
* Copyright(c) 2013 - 2017 Intel Corporation.
55
*
66
* This program is free software; you can redistribute it and/or modify it
77
* under the terms and conditions of the GNU General Public License,
@@ -390,6 +390,8 @@ static void i40e_parse_cee_app_tlv(struct i40e_cee_feat_tlv *tlv,
390390

391391
if (!dcbcfg->numapps)
392392
return;
393+
if (dcbcfg->numapps > I40E_DCBX_MAX_APPS)
394+
dcbcfg->numapps = I40E_DCBX_MAX_APPS;
393395

394396
for (i = 0; i < dcbcfg->numapps; i++) {
395397
u8 up, selector;

0 commit comments

Comments
 (0)