[PATCH] vdpa/ifc: fix null pointer dereference

Pei, Andy andy.pei at intel.com
Wed Jun 15 09:08:24 CEST 2022


Hi Chenbo,

Thanks for your reply.
I will fix this in next version.

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia at intel.com>
> Sent: Wednesday, June 15, 2022 10:04 AM
> To: Pei, Andy <andy.pei at intel.com>; dev at dpdk.org
> Cc: maxime.coquelin at redhat.com; Wang, Xiao W <xiao.w.wang at intel.com>;
> Xu, Rosen <rosen.xu at intel.com>; Xiao, QimaiX <qimaix.xiao at intel.com>
> Subject: RE: [PATCH] vdpa/ifc: fix null pointer dereference
> 
> Hi Andy,
> 
> > -----Original Message-----
> > From: Pei, Andy <andy.pei at intel.com>
> > Sent: Wednesday, June 8, 2022 3:34 PM
> > To: dev at dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia at intel.com>; maxime.coquelin at redhat.com;
> > Wang, Xiao W <xiao.w.wang at intel.com>; Xu, Rosen <rosen.xu at intel.com>;
> > Xiao, QimaiX <qimaix.xiao at intel.com>
> > Subject: [PATCH] vdpa/ifc: fix null pointer dereference
> >
> > Fix null pointer dereference reported in coverity scan.
> >
> > Coverity issue: 378882
> > Fixes: 8162a4a9 ("vdpa/ifc/base: access correct register for blk
> > device")
> 
> Commit id need to be 12 digits. Also pls leave a blank line between Fixes tag
> and signed-off
> 
> Thanks,
> Chenbo
> 
> > Signed-off-by: Andy Pei <andy.pei at intel.com>
> > ---
> >  drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/vdpa/ifc/base/ifcvf.c
> > b/drivers/vdpa/ifc/base/ifcvf.c index dd475a7..0a9f71a 100644
> > --- a/drivers/vdpa/ifc/base/ifcvf.c
> > +++ b/drivers/vdpa/ifc/base/ifcvf.c
> > @@ -255,6 +255,10 @@
> >  	u32 ring_state;
> >
> >  	cfg = hw->common_cfg;
> > +	if (!cfg) {
> > +		DEBUGOUT("common_cfg in HW is NULL.\n");
> > +		return;
> > +	}
> >
> >  	IFCVF_WRITE_REG16(IFCVF_MSI_NO_VECTOR, &cfg->msix_config);
> >  	for (i = 0; i < hw->nr_vring; i++) { @@ -262,6 +266,11 @@
> >  		IFCVF_WRITE_REG16(0, &cfg->queue_enable);
> >  		IFCVF_WRITE_REG16(IFCVF_MSI_NO_VECTOR, &cfg-
> > >queue_msix_vector);
> >
> > +		if (!hw->lm_cfg) {
> > +			DEBUGOUT("live migration cfg in HW is NULL.\n");
> > +			continue;
> > +		}
> > +
> >  		if (hw->device_type == IFCVF_BLK)
> >  			ring_state = *(u32 *)(hw->lm_cfg +
> >  					IFCVF_LM_RING_STATE_OFFSET +
> > --
> > 1.8.3.1



More information about the dev mailing list