* [PATCH] vdpa/ifc: fix null pointer dereference
@ 2022-06-08 7:34 Andy Pei
2022-06-08 8:25 ` Wang, Xiao W
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Andy Pei @ 2022-06-08 7:34 UTC (permalink / raw)
To: dev; +Cc: chenbo.xia, maxime.coquelin, xiao.w.wang, rosen.xu, qimaix.xiao
Fix null pointer dereference reported in coverity scan.
Coverity issue: 378882
Fixes: 8162a4a9 ("vdpa/ifc/base: access correct register for blk device")
Signed-off-by: Andy Pei <andy.pei@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
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] vdpa/ifc: fix null pointer dereference
2022-06-08 7:34 [PATCH] vdpa/ifc: fix null pointer dereference Andy Pei
@ 2022-06-08 8:25 ` Wang, Xiao W
2022-06-15 2:04 ` Xia, Chenbo
2022-06-15 6:23 ` [PATCH v2] " Andy Pei
2 siblings, 0 replies; 8+ messages in thread
From: Wang, Xiao W @ 2022-06-08 8:25 UTC (permalink / raw)
To: Pei, Andy, dev; +Cc: Xia, Chenbo, maxime.coquelin, Xu, Rosen, Xiao, QimaiX
Hi
> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Wednesday, June 8, 2022 3:34 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> Wang, Xiao W <xiao.w.wang@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> Xiao, QimaiX <qimaix.xiao@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")
> Signed-off-by: Andy Pei <andy.pei@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
Acked-by: Xiao Wang <xiao.w.wang@intel.com>
BRs,
Xiao
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] vdpa/ifc: fix null pointer dereference
2022-06-08 7:34 [PATCH] vdpa/ifc: fix null pointer dereference Andy Pei
2022-06-08 8:25 ` Wang, Xiao W
@ 2022-06-15 2:04 ` Xia, Chenbo
2022-06-15 7:08 ` Pei, Andy
2022-06-15 6:23 ` [PATCH v2] " Andy Pei
2 siblings, 1 reply; 8+ messages in thread
From: Xia, Chenbo @ 2022-06-15 2:04 UTC (permalink / raw)
To: Pei, Andy, dev; +Cc: maxime.coquelin, Wang, Xiao W, Xu, Rosen, Xiao, QimaiX
Hi Andy,
> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Wednesday, June 8, 2022 3:34 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Wang,
> Xiao W <xiao.w.wang@intel.com>; Xu, Rosen <rosen.xu@intel.com>; Xiao,
> QimaiX <qimaix.xiao@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@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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] vdpa/ifc: fix null pointer dereference
2022-06-08 7:34 [PATCH] vdpa/ifc: fix null pointer dereference Andy Pei
2022-06-08 8:25 ` Wang, Xiao W
2022-06-15 2:04 ` Xia, Chenbo
@ 2022-06-15 6:23 ` Andy Pei
2022-06-17 12:40 ` Maxime Coquelin
2022-06-17 14:07 ` Maxime Coquelin
2 siblings, 2 replies; 8+ messages in thread
From: Andy Pei @ 2022-06-15 6:23 UTC (permalink / raw)
To: dev; +Cc: chenbo.xia, maxime.coquelin, xiao.w.wang, rosen.xu, qimaix.xiao
Fix null pointer dereference reported in coverity scan.
Coverity issue: 378882
Fixes: 5d75517beffe ("vdpa/ifc/base: access correct register for blk device")
Signed-off-by: Andy Pei <andy.pei@intel.com>
Acked-by: Xiao Wang <xiao.w.wang@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
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] vdpa/ifc: fix null pointer dereference
2022-06-15 2:04 ` Xia, Chenbo
@ 2022-06-15 7:08 ` Pei, Andy
0 siblings, 0 replies; 8+ messages in thread
From: Pei, Andy @ 2022-06-15 7:08 UTC (permalink / raw)
To: Xia, Chenbo, dev; +Cc: maxime.coquelin, Wang, Xiao W, Xu, Rosen, Xiao, QimaiX
Hi Chenbo,
Thanks for your reply.
I will fix this in next version.
> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Wednesday, June 15, 2022 10:04 AM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Wang, Xiao W <xiao.w.wang@intel.com>;
> Xu, Rosen <rosen.xu@intel.com>; Xiao, QimaiX <qimaix.xiao@intel.com>
> Subject: RE: [PATCH] vdpa/ifc: fix null pointer dereference
>
> Hi Andy,
>
> > -----Original Message-----
> > From: Pei, Andy <andy.pei@intel.com>
> > Sent: Wednesday, June 8, 2022 3:34 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> > Wang, Xiao W <xiao.w.wang@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> > Xiao, QimaiX <qimaix.xiao@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@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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] vdpa/ifc: fix null pointer dereference
2022-06-15 6:23 ` [PATCH v2] " Andy Pei
@ 2022-06-17 12:40 ` Maxime Coquelin
2022-06-17 14:07 ` Maxime Coquelin
1 sibling, 0 replies; 8+ messages in thread
From: Maxime Coquelin @ 2022-06-17 12:40 UTC (permalink / raw)
To: Andy Pei, dev; +Cc: chenbo.xia, xiao.w.wang, rosen.xu, qimaix.xiao
On 6/15/22 08:23, Andy Pei wrote:
> Fix null pointer dereference reported in coverity scan.
>
> Coverity issue: 378882
> Fixes: 5d75517beffe ("vdpa/ifc/base: access correct register for blk device")
>
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> Acked-by: Xiao Wang <xiao.w.wang@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 +
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] vdpa/ifc: fix null pointer dereference
2022-06-15 6:23 ` [PATCH v2] " Andy Pei
2022-06-17 12:40 ` Maxime Coquelin
@ 2022-06-17 14:07 ` Maxime Coquelin
2022-06-18 9:04 ` Pei, Andy
1 sibling, 1 reply; 8+ messages in thread
From: Maxime Coquelin @ 2022-06-17 14:07 UTC (permalink / raw)
To: Andy Pei, dev; +Cc: chenbo.xia, xiao.w.wang, rosen.xu, qimaix.xiao
On 6/15/22 08:23, Andy Pei wrote:
> Fix null pointer dereference reported in coverity scan.
>
> Coverity issue: 378882
> Fixes: 5d75517beffe ("vdpa/ifc/base: access correct register for blk device")
>
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> Acked-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
> drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
Applied to dpdk-next-virtio/main.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v2] vdpa/ifc: fix null pointer dereference
2022-06-17 14:07 ` Maxime Coquelin
@ 2022-06-18 9:04 ` Pei, Andy
0 siblings, 0 replies; 8+ messages in thread
From: Pei, Andy @ 2022-06-18 9:04 UTC (permalink / raw)
To: Maxime Coquelin, dev; +Cc: Xia, Chenbo, Wang, Xiao W, Xu, Rosen, Xiao, QimaiX
Hi Maxime,
Thanks for your effort.
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Friday, June 17, 2022 10:08 PM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>; Xu, Rosen <rosen.xu@intel.com>; Xiao, QimaiX
> <qimaix.xiao@intel.com>
> Subject: Re: [PATCH v2] vdpa/ifc: fix null pointer dereference
>
>
>
> On 6/15/22 08:23, Andy Pei wrote:
> > Fix null pointer dereference reported in coverity scan.
> >
> > Coverity issue: 378882
> > Fixes: 5d75517beffe ("vdpa/ifc/base: access correct register for blk device")
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > Acked-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> > drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
>
> Applied to dpdk-next-virtio/main.
>
> Thanks,
> Maxime
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-06-18 9:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 7:34 [PATCH] vdpa/ifc: fix null pointer dereference Andy Pei
2022-06-08 8:25 ` Wang, Xiao W
2022-06-15 2:04 ` Xia, Chenbo
2022-06-15 7:08 ` Pei, Andy
2022-06-15 6:23 ` [PATCH v2] " Andy Pei
2022-06-17 12:40 ` Maxime Coquelin
2022-06-17 14:07 ` Maxime Coquelin
2022-06-18 9:04 ` Pei, Andy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).