[PATCH v1 03/31] net/ntnic: add return code handling
Serhii Iliushyk
sil-plv at napatech.com
Tue Jan 21 18:07:41 CET 2025
From: Danylo Vodopianov <dvo-plv at napatech.com>
CI found couple coverity problems which were fixed in this commit.
CID: 448984, 448982, 448975, 448969, 448968, 448967
API usage errors (BAD_COMPARE).
Add memcmp return value checking.
Coverity issue: 448984
Fixes: 6e8b7f11205f ("net/ntnic: add categorizer (CAT) FPGA module")
Signed-off-by: Danylo Vodopianov <dvo-plv at napatech.com>
---
drivers/net/ntnic/include/hw_mod_backend.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h
index f91a3ed058..40002f3343 100644
--- a/drivers/net/ntnic/include/hw_mod_backend.h
+++ b/drivers/net/ntnic/include/hw_mod_backend.h
@@ -114,10 +114,10 @@ enum {
typeof(be_module_reg) *temp_be_module = &(be_module_reg); \
typeof(idx) tmp_idx = (idx); \
typeof(cmp_idx) tmp_cmp_idx = (cmp_idx); \
- if ((unsigned int)(tmp_idx) != (unsigned int)(tmp_cmp_idx)) { \
- (void)memcmp(temp_be_module + tmp_idx, &temp_be_module[tmp_cmp_idx], \
- sizeof(type)); \
- } \
+ if ((unsigned int)(tmp_idx) != (unsigned int)(tmp_cmp_idx)) \
+ if (memcmp(temp_be_module + tmp_idx, &temp_be_module[tmp_cmp_idx], \
+ sizeof(type)) == 0) \
+ return 1; \
} while (0)
static inline int is_non_zero(const void *addr, size_t n)
--
2.45.0
More information about the dev
mailing list