Messages in this thread | | | Date | Mon, 10 Apr 2023 11:54:27 +0200 | From | Simon Horman <> | Subject | Re: [PATCH net-next v4 02/14] sfc: implement MCDI interface for vDPA operations |
| |
On Fri, Apr 07, 2023 at 01:40:03PM +0530, Gautam Dawar wrote: > Implement functions to perform vDPA operations like creating and > removing virtqueues, getting doorbell register offset etc. using > the MCDI interface with FW. > > Signed-off-by: Gautam Dawar <gautam.dawar@amd.com>
Hi Gautam,
thanks for your patch. I think that I found a minor problem, as described below.
...
> diff --git a/drivers/net/ethernet/sfc/mcdi_vdpa.c b/drivers/net/ethernet/sfc/mcdi_vdpa.c
...
> +void efx_vdpa_vring_fini(struct efx_vring_ctx *vring_ctx) > +{ > + kfree(vring_ctx); > +} > + > +int efx_vdpa_get_features(struct efx_nic *efx, > + enum ef100_vdpa_device_type type, > + u64 *features) > +{ > + MCDI_DECLARE_BUF(outbuf, MC_CMD_VIRTIO_GET_FEATURES_OUT_LEN); > + MCDI_DECLARE_BUF(inbuf, MC_CMD_VIRTIO_GET_FEATURES_IN_LEN); > + u32 high_val, low_val; > + ssize_t outlen; > + int rc; > + > + if (!efx) { > + pci_err(efx->pci_dev, "%s: Invalid NIC pointer\n", __func__);
efx is NULL but it is dereferenced.
Reported by Smatch as:
drivers/net/ethernet/sfc/mcdi_vdpa.c:72 efx_vdpa_get_features() error: we previously assumed 'efx' could be null (see line 71)
And by Coccinelle as:
drivers/net/ethernet/sfc/mcdi_vdpa.c:72:15-22: ERROR: efx is NULL but dereferenced.
> + return -EINVAL; > + }
...
| |