vdpa/ifc: fix null pointer dereference
PATCH 1/1 vdpa/ifc: fix null pointer dereference
Fix null pointer dereference reported in coverity scan.
Coverity issue: 378882
--- drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/vdpa/ifc/base/ifcvf.c +9 -0
@@ -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 +
Signature · 1 line
1.8.3.1
Hi
Quoted 45 lines
-----Original Message-----
From: Pei, Andy <[email protected]>
Sent: Wednesday, June 8, 2022 3:34 PM
To: [email protected]
Cc: Xia, Chenbo <[email protected]>; [email protected]; Wang, Xiao W <[email protected]>; Xu, Rosen <[email protected]>; Xiao, QimaiX <[email protected]>
Subject: [PATCH] vdpa/ifc: fix null pointer dereferenceFix 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 <[email protected]>--- drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/vdpa/ifc/base/ifcvf.c +9
-0@@ -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 +
Quoted 3 lines
IFCVF_LM_RING_STATE_OFFSET+
--
1.8.3.1
BRs,
Xiao
Hi Andy,
Quoted 9 lines
-----Original Message-----
From: Pei, Andy <[email protected]>
Sent: Wednesday, June 8, 2022 3:34 PM
To: [email protected]
Cc: Xia, Chenbo <[email protected]>; [email protected]; Wang, Xiao W <[email protected]>; Xu, Rosen <[email protected]>; Xiao, QimaiX <[email protected]>
Subject: [PATCH] vdpa/ifc: fix null pointer dereference
Quoted 4 lines
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
Quoted 35 lines
Signed-off-by Andy Pei <[email protected]>--- drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/vdpa/ifc/base/ifcvf.c +9
-0@@ -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
Hi Chenbo,
Thanks for your reply.
I will fix this in next version.
Quoted 65 lines
-----Original Message-----
From: Xia, Chenbo <[email protected]>
Sent: Wednesday, June 15, 2022 10:04 AM
To: Pei, Andy <[email protected]>; [email protected]
Cc: [email protected]; Wang, Xiao W <[email protected]>; Xu, Rosen <[email protected]>; Xiao, QimaiX <[email protected]>
Subject: RE: [PATCH] vdpa/ifc: fix null pointer dereferenceHi Andy,
Quoted 9 lines
-----Original Message-----
From: Pei, Andy <[email protected]>
Sent: Wednesday, June 8, 2022 3:34 PM
To: [email protected]
Cc: Xia, Chenbo <[email protected]>; [email protected]; Wang, Xiao W <[email protected]>; Xu, Rosen <[email protected]>; Xiao, QimaiX <[email protected]>
Subject: [PATCH] vdpa/ifc: fix null pointer dereferenceQuoted 5 lines
Fix null pointer dereference reported in coverity scan.
Coverity issue: 378882
Fixes 8162a4a9 ("vdpa/ifc/base: access correct register for blkdevice")
Commit id need to be 12 digits. Also pls leave a blank line between Fixes tag and signed-off
Thanks,
ChenboQuoted 34 lines
Signed-off-by Andy Pei <[email protected]>--- drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++ 1 file changed, 9 insertions(+)(quoted diff) +0
-0
b/drivers/vdpa/ifc/base/ifcvf.cindex dd475a7..0a9f71a 100644drivers/vdpa/ifc/base/ifcvf.c +4
-0@@ -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 @@drivers/vdpa/ifc/base/ifcvf.c +0
-0IFCVF_WRITE_REG16 (0 , &cfg->queue_enable); IFCVF_WRITE_REG16(IFCVF_MSI_NO_VECTOR, &cfg-Quoted 1 line
queue_msix_vector);drivers/vdpa/ifc/base/ifcvf.c +5
-1+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
PATCH v2 1/1 vdpa/ifc: fix null pointer dereference
In reply to Andy PeiFix null pointer dereference reported in coverity scan.
Coverity issue: 378882
--- drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/vdpa/ifc/base/ifcvf.c +9 -0
@@ -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 +
Signature · 1 line
1.8.3.1
Quoted 28 lines · Andy Pei
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 <[email protected]>Acked-by Xiao Wang <[email protected]>--- drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/vdpa/ifc/base/ifcvf.c +4
-0@@ -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);
drivers/vdpa/ifc/base/ifcvf.c line 276
Quoted 10 lines
drivers/vdpa/ifc/base/ifcvf.c +5
-0IFCVF_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 +
Thanks,
Maxime
Maxime Coquelin
AppliedQuoted 11 lines · Andy Pei
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 <[email protected]>Acked-by Xiao Wang <[email protected]>--- drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Applied to dpdk-next-virtio/main.
Thanks,
Maxime
Hi Maxime,
Thanks for your effort.
Quoted 28 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Friday, June 17, 2022 10:08 PM
To: Pei, Andy <[email protected]>; [email protected]
Cc: Xia, Chenbo <[email protected]>; Wang, Xiao W <[email protected]>; Xu, Rosen <[email protected]>; Xiao, QimaiX <[email protected]>
Subject: Re: [PATCH v2] vdpa/ifc: fix null pointer dereferenceQuoted 11 lines · Andy Pei
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 <[email protected]>Acked-by Xiao Wang <[email protected]>--- drivers/vdpa/ifc/base/ifcvf.c | 9 +++++++++ 1 file changed, 9 insertions(+)Applied to dpdk-next-virtio/main.
Thanks,
Maxime