DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Andy Pei <andy.pei@intel.com>, dev@dpdk.org
Cc: chenbo.xia@intel.com, xiao.w.wang@intel.com, rosen.xu@intel.com,
	qimaix.xiao@intel.com
Subject: Re: [PATCH v2] vdpa/ifc: fix null pointer dereference
Date: Fri, 17 Jun 2022 14:40:32 +0200	[thread overview]
Message-ID: <db084877-14ab-b8d5-9a8d-28c93dddbcc0@redhat.com> (raw)
In-Reply-To: <1655274214-164117-1-git-send-email-andy.pei@intel.com>



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


  reply	other threads:[~2022-06-17 12:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08  7:34 [PATCH] " 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 [this message]
2022-06-17 14:07   ` Maxime Coquelin
2022-06-18  9:04     ` Pei, Andy
2022-06-15  6:16 Andy Pei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db084877-14ab-b8d5-9a8d-28c93dddbcc0@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=andy.pei@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=qimaix.xiao@intel.com \
    --cc=rosen.xu@intel.com \
    --cc=xiao.w.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).