All of lore.kernel.org
 help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai-tJV4Np9+EQGJLDu7R2Hb2g@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: Re: [PATCH 2/2] devargs: remove limit on parameters length
Date: Thu, 08 Jan 2015 11:15:47 +0200	[thread overview]
Message-ID: <54AE4AC3.80205@laiskiainen.org> (raw)
In-Reply-To: <20150107145900.2a139ee6@urahara>

On 01/08/2015 12:59 AM, Stephen Hemminger wrote:
> On Wed,  7 Jan 2015 14:03:29 +0100
> David Marchand <david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> wrote:
>
>> +	buf = strdup(devargs_str);
>> +	if (buf == NULL) {
>> +		RTE_LOG(ERR, EAL, "cannot allocate temp memory for devargs\n");
>> +		goto fail;
>> +	}
>> +
>
> If string is only used in same function you might consider using strdupa() which avoids
> worrying about freeing in error paths.
>

It also "frees" you from having to worry about failures in the first 
place because alloca() failures are not nice and catchable, its 
undefined behavior.

If arbitrary length parameters is the goal then using the alloca() 
family of functions is replacing a controlled failure with an 
unpredictable crash.

	- Panu -

  parent reply	other threads:[~2015-01-08  9:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 13:03 [PATCH 0/2] remove limit on devargs parameters length David Marchand
     [not found] ` <1420635809-30976-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-07 13:03   ` [PATCH 1/2] devargs: indent and cleanup David Marchand
2015-01-07 13:03   ` [PATCH 2/2] devargs: remove limit on parameters length David Marchand
     [not found]     ` <1420635809-30976-3-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-07 22:59       ` Stephen Hemminger
2015-01-08  8:19         ` David Marchand
2015-01-08  9:15         ` Panu Matilainen [this message]
2015-02-13 15:03   ` [PATCH v2 0/3] remove limit on devargs " David Marchand
     [not found]     ` <1423839795-29450-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-13 15:03       ` [PATCH v2 1/3] devargs: indent and cleanup David Marchand
2015-02-13 15:03       ` [PATCH v2 2/3] devargs: remove limit on parameters length David Marchand
2015-02-13 15:03       ` [PATCH v2 3/3] app/test: fix devargs tests David Marchand
2015-02-18 12:44       ` [PATCH v2 0/3] remove limit on devargs parameters length 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=54AE4AC3.80205@laiskiainen.org \
    --to=pmatilai-tjv4np9+eqgjldu7r2hb2g@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.