From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: Andrew Rybchenko <arybchenko@solarflare.com>,
"olivier.matz@6wind.com" <olivier.matz@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] mempool: check for invalid args on creation
Date: Wed, 1 Aug 2018 18:16:14 +0000 [thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D8977F908ED4@IRSMSX107.ger.corp.intel.com> (raw)
In-Reply-To: <6a46bfe4-c016-dacc-74d4-5e61a161fced@solarflare.com>
Hi Andrew,
> -----Original Message-----
> From: Andrew Rybchenko [mailto:arybchenko@solarflare.com]
> Sent: Friday, July 20, 2018 4:49 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> olivier.matz@6wind.com
> Cc: dev@dpdk.org
> Subject: Re: [PATCH] mempool: check for invalid args on creation
>
> On 17.07.2018 13:37, Pablo de Lara wrote:
> > Currently, a mempool can be created if the number of objects is zero
> > or the size of these is zero.
> > In these scenarios, rte_mempool_create should return NULL, as the
> > mempool created is useless.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > ---
> > lib/librte_mempool/rte_mempool.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/lib/librte_mempool/rte_mempool.c
> > b/lib/librte_mempool/rte_mempool.c
> > index 8c8b9f809..8c9573f1a 100644
> > --- a/lib/librte_mempool/rte_mempool.c
> > +++ b/lib/librte_mempool/rte_mempool.c
> > @@ -916,6 +916,18 @@ rte_mempool_create_empty(const char *name,
> > unsigned n, unsigned elt_size,
> >
> > mempool_list = RTE_TAILQ_CAST(rte_mempool_tailq.head,
> > rte_mempool_list);
> >
> > + /* asked for zero items */
> > + if (n == 0) {
> > + rte_errno = EINVAL;
> > + return NULL;
> > + }
>
> I agree which the check since attempt to populate it will most likely fail with -
> ENOSPC.
>
> > +
> > + /* asked for zero-sized elements */
> > + if (elt_size == 0) {
> > + rte_errno = EINVAL;
> > + return NULL;
> > + }
> > +
>
> I'm not sure about this one. I could imagine the case when mempool elements
> are used just as unique markers. So, I'm not sure that we should restrict such
> usage.
I can drop this one and send a v2 on the first check. Is that OK?
Thanks!
Pablo
next prev parent reply other threads:[~2018-08-01 18:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-17 10:37 Pablo de Lara
2018-07-20 15:49 ` Andrew Rybchenko
2018-08-01 18:16 ` De Lara Guarch, Pablo [this message]
2018-08-02 7:15 ` Andrew Rybchenko
2018-08-02 0:35 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
2018-08-02 11:10 ` Andrew Rybchenko
2018-08-05 13:35 ` Thomas Monjalon
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=E115CCD9D858EF4F90C690B0DCB4D8977F908ED4@IRSMSX107.ger.corp.intel.com \
--to=pablo.de.lara.guarch@intel.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).