From: Martin Spinler Date: Wed, 1 Apr 2020 06:38:01 +0000 (+0200) Subject: net/nfb: check array size before access X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=dc7920c76c1cabf702df03a20d15a5dc89b38fea;p=dpdk.git net/nfb: check array size before access The driver wrongly assumed the presence of at least one rxmac in every firmware and accessed to non-existing unit Signed-off-by: Martin Spinler Acked-by: Jakub Neruda --- diff --git a/drivers/net/nfb/nfb_rxmode.c b/drivers/net/nfb/nfb_rxmode.c index 3327c8272b..2d0b613d21 100644 --- a/drivers/net/nfb/nfb_rxmode.c +++ b/drivers/net/nfb/nfb_rxmode.c @@ -54,7 +54,8 @@ nfb_eth_promiscuous_get(struct rte_eth_dev *dev) struct nc_rxmac_status status; status.mac_filter = RXMAC_MAC_FILTER_PROMISCUOUS; - nc_rxmac_read_status(internals->rxmac[0], &status); + if (internals->max_rxmac > 0) + nc_rxmac_read_status(internals->rxmac[0], &status); return (status.mac_filter == RXMAC_MAC_FILTER_PROMISCUOUS); } @@ -102,7 +103,9 @@ nfb_eth_allmulticast_get(struct rte_eth_dev *dev) struct nc_rxmac_status status; status.mac_filter = RXMAC_MAC_FILTER_PROMISCUOUS; - nc_rxmac_read_status(internals->rxmac[0], &status); + + if (internals->max_rxmac > 0) + nc_rxmac_read_status(internals->rxmac[0], &status); return (status.mac_filter == RXMAC_MAC_FILTER_TABLE_BCAST_MCAST); }