From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from homiemail-a50.g.dreamhost.com (sub5.mail.dreamhost.com [208.113.200.129]) by dpdk.org (Postfix) with ESMTP id 966F012A8 for ; Thu, 8 Jan 2015 10:15:52 +0100 (CET) Received: from homiemail-a50.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a50.g.dreamhost.com (Postfix) with ESMTP id 5D2882019 for ; Thu, 8 Jan 2015 01:15:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=laiskiainen.org; h= message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; s= laiskiainen.org; bh=mBojz7KOwBJcL0zkij4s7oWMvYI=; b=AmDM3bpV0RFC okNVlna03o7HIGZHhOKc44BNgU99bQUOnueJjR8Cf1nsM8fH91J/CUdo6cemDQyA o96j/wP8Q8YLomIPAntnAqUwGkce3mfU40rubRXV660b6ste/98SfUesal98FbXs 2It3I0KCBCAwOPbhwM/KOYU9wOpb08g= Received: from localhost.localdomain (adsl-86.60.130.33.DynIP.ssp.fi [86.60.130.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pmatilai@laiskiainen.org) by homiemail-a50.g.dreamhost.com (Postfix) with ESMTPSA id E918C2009 for ; Thu, 8 Jan 2015 01:15:50 -0800 (PST) Message-ID: <54AE4AC3.80205@laiskiainen.org> Date: Thu, 08 Jan 2015 11:15:47 +0200 From: Panu Matilainen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: dev@dpdk.org References: <1420635809-30976-1-git-send-email-david.marchand@6wind.com> <1420635809-30976-3-git-send-email-david.marchand@6wind.com> <20150107145900.2a139ee6@urahara> In-Reply-To: <20150107145900.2a139ee6@urahara> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 2/2] devargs: remove limit on parameters length X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jan 2015 09:15:52 -0000 On 01/08/2015 12:59 AM, Stephen Hemminger wrote: > On Wed, 7 Jan 2015 14:03:29 +0100 > David Marchand 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 -