patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Chenbo Xia <chenbo.xia@intel.com>, dev@dpdk.org
Cc: stable@dpdk.org
Subject: Re: [dpdk-stable] [PATCH] examples/vhost: fix unchecked return value
Date: Fri, 19 Mar 2021 10:50:44 +0100	[thread overview]
Message-ID: <10e76c6b-f3be-e86a-f72b-8bb63510863d@redhat.com> (raw)
In-Reply-To: <20210219024011.77233-1-chenbo.xia@intel.com>



On 2/19/21 3:40 AM, Chenbo Xia wrote:
> This patch fixes unchecked return value for rte_vhost_get_mem_table(),
> which is reported by coverity.
> 
> Coverity issue: 364233
> Fixes: ca059fa5e290 ("examples/vhost: demonstrate the new generic APIs")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
> ---
>  examples/vhost/virtio_net.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c
> index 64bf3d19ff..9064fc3a82 100644
> --- a/examples/vhost/virtio_net.c
> +++ b/examples/vhost/virtio_net.c
> @@ -23,6 +23,7 @@ vs_vhost_net_setup(struct vhost_dev *dev)
>  	uint16_t i;
>  	int vid = dev->vid;
>  	struct vhost_queue *queue;
> +	int ret;
>  
>  	RTE_LOG(INFO, VHOST_CONFIG,
>  		"setting builtin vhost-user net driver\n");
> @@ -33,7 +34,12 @@ vs_vhost_net_setup(struct vhost_dev *dev)
>  	else
>  		dev->hdr_len = sizeof(struct virtio_net_hdr);
>  
> -	rte_vhost_get_mem_table(vid, &dev->mem);
> +	ret = rte_vhost_get_mem_table(vid, &dev->mem);
> +	if (ret < 0) {
> +		RTE_LOG(ERR, VHOST_CONFIG, "Failed to get "
> +			"VM memory layout for device(%d)\n", vid);
> +		return;
> +	}
>  
>  	dev->nr_vrings = rte_vhost_get_vring_num(vid);
>  	for (i = 0; i < dev->nr_vrings; i++) {
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


  reply	other threads:[~2021-03-19  9:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19  2:40 Chenbo Xia
2021-03-19  9:50 ` Maxime Coquelin [this message]
2021-03-31  6:56 ` [dpdk-stable] [dpdk-dev] " Xia, Chenbo

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=10e76c6b-f3be-e86a-f72b-8bb63510863d@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /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).