DPDK patches and discussions
 help / color / mirror / Atom feed
From: Zhike Wang <wangzhike@jd.com>
To: dev@dpdk.org
Cc: olivier.matz@6wind.com, arybchenko@solarflare.com,
	Zhike Wang <wangzhike@jd.com>
Subject: [dpdk-dev] [PATCH] mempool: return ENOMEM if initial alloc size can not be satisfied
Date: Fri,  3 Jul 2020 16:41:32 +0800	[thread overview]
Message-ID: <1593765692-13265-1-git-send-email-wangzhike@jd.com> (raw)

Signed-off-by: Zhike Wang <wangzhike@jd.com>
---
 lib/librte_mempool/rte_mempool.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 0bde995..b24feb6 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -622,6 +622,12 @@ struct pagesz_walk_arg {
 			goto fail;
 		}
 
+		if (max_alloc_size < min_chunk_size) {
+			rte_errno = ENOMEM;
+			ret = -rte_errno;
+			goto fail;
+		}
+
 		/* if we're trying to reserve contiguous memory, add appropriate
 		 * memzone flag.
 		 */
-- 
1.8.3.1



             reply	other threads:[~2020-07-03  8:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03  8:41 Zhike Wang [this message]
2020-07-03  9:23 ` Andrew Rybchenko
2020-07-10  8:44   ` 王志克

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=1593765692-13265-1-git-send-email-wangzhike@jd.com \
    --to=wangzhike@jd.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.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).