patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: wenzhuo.lu@intel.com, qiming.yang@intel.com
Cc: dev@dpdk.org, xiaolong.ye@intel.com,
	Qi Zhang <qi.z.zhang@intel.com>,
	stable@dpdk.org, Dan Nowlin <dan.nowlin@intel.com>,
	Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Subject: [dpdk-stable] [PATCH v2 18/63] net/ice/base: resolve static analysis issues
Date: Thu, 29 Aug 2019 10:36:11 +0800	[thread overview]
Message-ID: <20190829023656.8220-19-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20190829023656.8220-1-qi.z.zhang@intel.com>

Coverity complains first_free can be -1 resulting in a negative shift left
when k equals 0; i.e. the expression 1 << (first_free - k). Fix this by
explicitly checking for this case.

Cc: stable@dpdk.org

Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_flex_pipe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index 29888df76..73362c909 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -4200,7 +4200,7 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es)
 				index = i + 1;
 
 			/* check for room */
-			if (first_free + 1 < ice_fd_pairs[index].count)
+			if (first_free + 1 < (s8)ice_fd_pairs[index].count)
 				return ICE_ERR_MAX_LIMIT;
 
 			/* place in extraction sequence */
@@ -4210,6 +4210,9 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es)
 				es[first_free - k].off =
 					ice_fd_pairs[index].off + (k * 2);
 
+				if (k > first_free)
+					return ICE_ERR_OUT_OF_RANGE;
+
 				/* keep track of non-relevant fields */
 				mask_sel |= 1 << (first_free - k);
 			}
-- 
2.13.6


  parent reply	other threads:[~2019-08-29  2:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190826105105.19121-1-qi.z.zhang@intel.com>
2019-08-26 10:50 ` [dpdk-stable] [PATCH " Qi Zhang
2019-08-26 10:50 ` [dpdk-stable] [PATCH 19/63] net/ice/base: fix memory leak issue Qi Zhang
2019-08-26 10:50 ` [dpdk-stable] [PATCH 21/63] net/ice/base: fix type-mismatch Qi Zhang
2019-08-26 10:50 ` [dpdk-stable] [PATCH 22/63] net/ice/base: correct overrun Coverty hit Qi Zhang
2019-08-26 10:50 ` [dpdk-stable] [PATCH 44/63] net/ice/base: fix for RSS hash on inner UDP port Qi Zhang
2019-08-26 10:50 ` [dpdk-stable] [PATCH 48/63] net/ice/base: fix flag settings in AQ call Qi Zhang
     [not found] ` <20190829023656.8220-1-qi.z.zhang@intel.com>
2019-08-29  2:36   ` Qi Zhang [this message]
2019-08-29  2:36   ` [dpdk-stable] [PATCH v2 19/63] net/ice/base: fix memory leak issue Qi Zhang
2019-08-29  2:36   ` [dpdk-stable] [PATCH v2 21/63] net/ice/base: fix type-mismatch Qi Zhang
2019-08-29  2:36   ` [dpdk-stable] [PATCH v2 22/63] net/ice/base: correct overrun Coverty hit Qi Zhang
2019-08-29  2:36   ` [dpdk-stable] [PATCH v2 44/63] net/ice/base: fix for RSS hash on inner UDP port Qi Zhang
2019-08-29  2:36   ` [dpdk-stable] [PATCH v2 48/63] net/ice/base: fix flag settings in AQ call Qi Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190829023656.8220-19-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=dan.nowlin@intel.com \
    --cc=dev@dpdk.org \
    --cc=paul.m.stillwell.jr@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    --cc=wenzhuo.lu@intel.com \
    --cc=xiaolong.ye@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).