patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: Yunjian Wang <wangyunjian@huawei.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "honnappa.nagarahalli@arm.com" <honnappa.nagarahalli@arm.com>,
	"dingxiaoxiong@huawei.com" <dingxiaoxiong@huawei.com>,
	"xudingke@huawei.com" <xudingke@huawei.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [dpdk-dev] [PATCH] ring: fix error return value when creating ring
Date: Mon, 10 Jan 2022 14:11:13 +0000	[thread overview]
Message-ID: <DM6PR11MB44915682AFA699ABB8E693949A509@DM6PR11MB4491.namprd11.prod.outlook.com> (raw)
In-Reply-To: <6d7c9da7eb47cb236710a870d91219f1c3ca4684.1641785123.git.wangyunjian@huawei.com>

> The error value returned by rte_ring_create_elem() should be positive
> integers. However, if the rte_ring_get_memsize_elem() function fails,
> a negative number is returned and is directly used as the return value.
> As a result, this will cause the external call to check the return
> value to fail(like called by rte_mempool_create()).
> 
> Fixes: a182620042aa ("ring: get size in memory")
> Cc: stable@dpdk.org
> 
> Reported-by: Nan Zhou <zhounan14@huawei.com>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  lib/ring/rte_ring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c
> index f17bd966be..185f9be798 100644
> --- a/lib/ring/rte_ring.c
> +++ b/lib/ring/rte_ring.c
> @@ -267,7 +267,7 @@ rte_ring_create_elem(const char *name, unsigned int esize, unsigned int count,
> 
>  	ring_size = rte_ring_get_memsize_elem(esize, count);
>  	if (ring_size < 0) {
> -		rte_errno = ring_size;
> +		rte_errno = -ring_size;
>  		return NULL;
>  	}
> 
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.27.0


  reply	other threads:[~2022-01-10 14:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10  9:23 Yunjian Wang
2022-01-10 14:11 ` Ananyev, Konstantin [this message]
2022-02-05 17:04   ` David Marchand

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=DM6PR11MB44915682AFA699ABB8E693949A509@DM6PR11MB4491.namprd11.prod.outlook.com \
    --to=konstantin.ananyev@intel.com \
    --cc=dev@dpdk.org \
    --cc=dingxiaoxiong@huawei.com \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=stable@dpdk.org \
    --cc=wangyunjian@huawei.com \
    --cc=xudingke@huawei.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).