[PATCH 11/12] net/xsc: optimize memcmp returns not 0 check
Renyong Wan
wanry at yunsilicon.com
Sat Feb 22 04:57:55 CET 2025
This issue was reported by PVS studio, described as:
https://pvs-studio.com/en/docs/warnings/v526/
Signed-off-by: Renyong Wan <wanry at yunsilicon.com>
---
drivers/net/xsc/xsc_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c
index 44d861e484..28af9c5d15 100644
--- a/drivers/net/xsc/xsc_ethdev.c
+++ b/drivers/net/xsc/xsc_ethdev.c
@@ -663,7 +663,7 @@ xsc_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uin
for (i = 0; i != XSC_MAX_MAC_ADDRESSES; ++i) {
if (i == (int)index)
continue;
- if (memcmp(&dev->data->mac_addrs[i], mac, sizeof(*mac)))
+ if (memcmp(&dev->data->mac_addrs[i], mac, sizeof(*mac)) != 0)
continue;
/* Address already configured elsewhere, return with error */
rte_errno = EADDRINUSE;
--
2.25.1
More information about the dev
mailing list