From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 37FB1A6A for ; Mon, 2 Mar 2015 15:40:13 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 02 Mar 2015 06:40:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,675,1418112000"; d="scan'208";a="685575963" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by fmsmga002.fm.intel.com with ESMTP; 02 Mar 2015 06:40:10 -0800 Received: from orsmsx154.amr.corp.intel.com (10.22.226.12) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 2 Mar 2015 06:40:10 -0800 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by ORSMSX154.amr.corp.intel.com (10.22.226.12) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 2 Mar 2015 06:40:10 -0800 Received: from fmsmsx113.amr.corp.intel.com ([169.254.13.112]) by FMSMSX102.amr.corp.intel.com ([169.254.10.244]) with mapi id 14.03.0195.001; Mon, 2 Mar 2015 06:40:09 -0800 From: "Wiles, Keith" To: David Marchand , "Wodkowski, PawelX" Thread-Topic: [dpdk-dev] [PATCH] eal: prevent dereferencing NULL pointer in rte_eal_devargs_add() Thread-Index: AQHQVPbIh6JtGzjqXUi57tQiLG/hvw== Date: Mon, 2 Mar 2015 14:40:09 +0000 Message-ID: References: <1425294562-26015-1-git-send-email-pawelx.wodkowski@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.255.66.73] Content-Type: text/plain; charset="us-ascii" Content-ID: <0660B7674CE17F40B24762E8F51C64ED@intel.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] eal: prevent dereferencing NULL pointer in rte_eal_devargs_add() 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: Mon, 02 Mar 2015 14:40:13 -0000 On 3/2/15, 6:23 AM, "David Marchand" wrote: >Hello Pawel, > >On Mon, Mar 2, 2015 at 12:09 PM, Pawel Wodkowski >> wrote: > >> On failure devargs->args should not be accesed if devargs is NULL. >> > >accessed. > > >> >> Signed-off-by: Pawel Wodkowski >> --- >> lib/librte_eal/common/eal_common_devargs.c | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/lib/librte_eal/common/eal_common_devargs.c >> b/lib/librte_eal/common/eal_common_devargs.c >> index 9b110f7..615945e 100644 >> --- a/lib/librte_eal/common/eal_common_devargs.c >> +++ b/lib/librte_eal/common/eal_common_devargs.c >> @@ -124,12 +124,13 @@ rte_eal_devargs_add(enum rte_devtype devtype, >>const >> char *devargs_str) >> return 0; >> >> fail: >> - if (devargs->args) >> - free(devargs->args); >> if (buf) >> free(buf); >> - if (devargs) >> + if (devargs) { >> + free(devargs->args); Do you not still need to check for args being NULL before calling free? >> free(devargs); >> + } >> + >> return -1; >> } >> >> >Fixes: c07691ae1089 ("devargs: remove limit on parameters length") >Acked-by: David Marchand > >--=20 >David Marchand