net/nfb: check rxmac array size
Checks
Commit Message
From: Martin Spinler <spinler@cesnet.cz>
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 <spinler@cesnet.cz>
Acked-by: Jakub Neruda <neruda@netcope.com>
Comments
On 4/1/2020 7:38 AM, Jakub Neruda wrote:
> From: Martin Spinler <spinler@cesnet.cz>
>
> 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 <spinler@cesnet.cz>
> Acked-by: Jakub Neruda <neruda@netcope.com>
Applied to dpdk-next-net/master, thanks.
@@ -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);
}