[dpdk-dev] [PATCH 1/2] net/ixgbe: fix unchecked return value
Wang, Haiyue
haiyue.wang at intel.com
Tue Oct 20 10:33:54 CEST 2020
> -----Original Message-----
> From: Walsh, Conor <conor.walsh at intel.com>
> Sent: Monday, October 19, 2020 20:26
> To: Guo, Jia <jia.guo at intel.com>; Wang, Haiyue <haiyue.wang at intel.com>; Yigit, Ferruh
> <ferruh.yigit at intel.com>; Awal, Mohammad Abdul <mohammad.abdul.awal at intel.com>; Doherty, Declan
> <declan.doherty at intel.com>
> Cc: dev at dpdk.org; Walsh, Conor <conor.walsh at intel.com>
> Subject: [PATCH 1/2] net/ixgbe: fix unchecked return value
>
> The return value of rte_eth_switch_domain_alloc() was not being checked
> within ixgbe_pf_host_init() which caused a coverity issue. If the call
> fails a warning is logged using PMD_INIT_LOG() and *vfinfo is free'd.
> ixgbe_pf_host_init() now has a return value which is checked in
> eth_ixgbe_dev_init()
>
> Coverity issue: 362795
> Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")
>
> Signed-off-by: Conor Walsh <conor.walsh at intel.com>
> ---
> drivers/net/ixgbe/ixgbe_ethdev.c | 6 ++++--
> drivers/net/ixgbe/ixgbe_ethdev.h | 2 +-
> drivers/net/ixgbe/ixgbe_pf.c | 16 +++++++++++++---
> 3 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 14a254ab74..49ff523ea8 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -1077,7 +1077,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
> IXGBE_DEV_PRIVATE_TO_BW_CONF(eth_dev->data->dev_private);
> uint32_t ctrl_ext;
> uint16_t csum;
> - int diag, i;
> + int diag, i, ret;
>
> PMD_INIT_FUNC_TRACE();
>
> @@ -1256,7 +1256,9 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
> memset(hwstrip, 0, sizeof(*hwstrip));
>
> /* initialize PF if max_vfs not zero */
> - ixgbe_pf_host_init(eth_dev);
> + ret = ixgbe_pf_host_init(eth_dev);
> + if (ret)
> + return ret;
>
Seems that just return is not enough, the eth_dev->data->mac_addrs and eth_dev->data->hash_mac_addrs
also needs to be freed, please refer to ' ice_dev_init':
static int
ice_dev_init(struct rte_eth_dev *dev)
rte_free(dev->data->mac_addrs);
dev->data->mac_addrs = NULL;
> --
> 2.25.1
More information about the dev
mailing list