patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 3/7] net/i40e/base: fix potential out of bound array access
       [not found] <1490174699-147026-1-git-send-email-jingjing.wu@intel.com>
@ 2017-03-22  9:24 ` Jingjing Wu
  0 siblings, 0 replies; only message in thread
From: Jingjing Wu @ 2017-03-22  9:24 UTC (permalink / raw)
  To: dev; +Cc: jingjing.wu, helin.zhang, beilei.xing, stable

This is fix for klocwork issue where dcbcfg->numapps could
be greater than size of array (i.e dcbcfg->app[I40E_DCBX_MAX_APPS]).
The fix makes sure the array is not accessed past size of array
(i.e. I40E_DCBX_MAX_APPS).

Fixes: 166dceeeeafc ("i40e/base: add parsing for CEE DCBX TLVs")
Cc: stable@dpdk.org
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/base/i40e_dcb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c
index 26c344f..9b5405d 100644
--- a/drivers/net/i40e/base/i40e_dcb.c
+++ b/drivers/net/i40e/base/i40e_dcb.c
@@ -396,6 +396,8 @@ static void i40e_parse_cee_app_tlv(struct i40e_cee_feat_tlv *tlv,
 	dcbcfg->numapps = length / sizeof(*app);
 	if (!dcbcfg->numapps)
 		return;
+	if (dcbcfg->numapps > I40E_DCBX_MAX_APPS)
+		dcbcfg->numapps = I40E_DCBX_MAX_APPS;
 
 	for (i = 0; i < dcbcfg->numapps; i++) {
 		u8 up, selector;
-- 
2.4.11

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-22  9:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1490174699-147026-1-git-send-email-jingjing.wu@intel.com>
2017-03-22  9:24 ` [dpdk-stable] [PATCH 3/7] net/i40e/base: fix potential out of bound array access Jingjing Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).