[v2,20/34] net/ntnic: fix array verification

Message ID 20250205104548.1533554-21-sil-plv@napatech.com (mailing list archive)
State Accepted
Delegated to: Stephen Hemminger
Headers
Series net/ntnic: bugfixes and refactoring |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Serhii Iliushyk Feb. 5, 2025, 10:45 a.m. UTC
From: Danylo Vodopianov <dvo-plv@napatech.com>

if statement was modify to ensure that word_off
doesn't exceed the size of the array

Coverity issue: 448958
Fixes: 7fa0bf29e667 ("net/ntnic: add hash module")

Signed-off-by: Danylo Vodopianov <dvo-plv@napatech.com>
---
 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c
index cc8db2fae5..d19e72e323 100644
--- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c
+++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c
@@ -221,7 +221,7 @@  static int hw_mod_hsh_rcp_mod(struct flow_api_backend_s *be, enum hw_hsh_e field
 			break;
 
 		case HW_HSH_RCP_WORD_MASK:
-			if (word_off > HSH_RCP_WORD_MASK_SIZE) {
+			if (word_off >= HSH_RCP_WORD_MASK_SIZE) {
 				WORD_OFF_TOO_LARGE_LOG;
 				return WORD_OFF_TOO_LARGE;
 			}