[4/5] net/nfp: fix integer shift problem

Message ID 20231115032310.756221-5-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series fix coverity issues |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Nov. 15, 2023, 3:23 a.m. UTC
  CI found integer handling issues, bad shift.

Coverity issue: 385412
Fixes: e6858e7e7cd3 ("net/nfp: move shared target logic to own file")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfpcore/nfp_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/nfp/nfpcore/nfp_target.c b/drivers/net/nfp/nfpcore/nfp_target.c
index ecb45f7928..ea5b39a4b9 100644
--- a/drivers/net/nfp/nfpcore/nfp_target.c
+++ b/drivers/net/nfp/nfpcore/nfp_target.c
@@ -528,7 +528,7 @@  nfp_mask64(int msb,
 		return 0;
 
 	width = msb - lsb + 1;
-	if (width < 0)
+	if (width <= 0)
 		return 0;
 
 	if (width == 64)