There is a potential issue seen by static tools if number of multicast
addresses is zero, and rte_realloc of zero size fails (ie returns NULL).
This won't happen in real world for a couple of reasons: Azure doesn't
support multicast (ie this is dead code); and rte_realloc of zero size
will never fail, but safe to just always return -ENOMEM of realloc fails.

Coverity issue: 323487
Fixes: 901efc0da925 ("net/failsafe: support multicast address list set")
Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 drivers/net/failsafe/failsafe_ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/failsafe/failsafe_ops.c 
b/drivers/net/failsafe/failsafe_ops.c
index 7f8bcd4c69f4..a20953a662e1 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -1155,7 +1155,7 @@ fs_set_mc_addr_list(struct rte_eth_dev *dev,
 
        mcast_addrs = rte_realloc(PRIV(dev)->mcast_addrs,
                nb_mc_addr * sizeof(PRIV(dev)->mcast_addrs[0]), 0);
-       if (mcast_addrs == NULL && nb_mc_addr > 0) {
+       if (mcast_addrs == NULL) {
                ret = -ENOMEM;
                goto rollback;
        }
-- 
2.17.1

Reply via email to