From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com [209.85.128.172]) by dpdk.org (Postfix) with ESMTP id 7587716E for ; Mon, 18 Dec 2017 11:51:32 +0100 (CET) Received: by mail-wr0-f172.google.com with SMTP id o2so13611340wro.5 for ; Mon, 18 Dec 2017 02:51:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Yhl+9iOX5cJIjewqbYDRVbmkU+e0RDAoXh5VFqDASaY=; b=NcSgSHZQ5Z84Lq0uywQ7zz4o5axfhbPDv+nFXwzL/nGW9MHdDYMX6cET0u4VgZpHP/ 46v/U9GEaPil0Qux0SVSbNGYUr78YPViqYMMKw5djtqsz7LKoKEbh1ThMLF9HUbpuoMy ugoOMn3Z88T7Z29VS2219cIgaZ1wpRI0jzKJdvqXm3WyT1YPugsBFlrWhu4MqAqEr1mu nxLrWZrTyKtfbwLjimImlWny5NgiZ6/1ntfBrO6yeuSOT1B6tUUpiD4Cj3r9i4MjJYWx 99Io1s1Jb9NAh3RdCykxqsTjAIPmC4nM+mBr91ESE+wQOhKD0p2sTSBBYI8OIOeUJUlS uHAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Yhl+9iOX5cJIjewqbYDRVbmkU+e0RDAoXh5VFqDASaY=; b=kKM6jZzdmEkX44HiXOmuhadJHnpIOcZgXeVlULOOGI5R1W690vnt2gV4WBEH14YY2V UTxsJUOgYcbhXAM5tHqnN2iV2Rj/lKEStK21EJfhti2xlOT4g3uzSmHazvoCTsMNuLpC DzPatun+w/Wp25poZnj59tQP23FOnNn5wfKolBeQhMmtp+BEnY17M3OcLRkHDTeqqwG/ buSXY4I4PbevqVepNGdFbp5i7seL0mrx+XnYSQ+WwPYujyKRu9t1CywBGjpbRkVRlIco +hR6v0BrhGdm9ywMUc1iL8dZZ30PAwhq4rSc3yrQTAzRT5c7w62OeyhGyOP7VGz3nJBk 4GnA== X-Gm-Message-State: AKGB3mLEDTapDe965G+awoxVpFlbcqJPUWPHhLljHAZ3KTMxAPrzbL6/ sGqRfkeTLoDTXDtQR6xCH1iogxTn X-Google-Smtp-Source: ACJfBotn863j8yReLfEgdWKklkYcDgI8r0SOvo578RbjdoESlJI4xuMdxpydYd3W7khqAQE3gIJYTA== X-Received: by 10.223.150.108 with SMTP id c41mr6242544wra.119.1513594292184; Mon, 18 Dec 2017 02:51:32 -0800 (PST) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id g54sm2089170wrg.43.2017.12.18.02.51.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 02:51:31 -0800 (PST) Date: Mon, 18 Dec 2017 11:51:19 +0100 From: Adrien Mazarguil To: Olivier MATZ Cc: Xueming Li , dev@dpdk.org Message-ID: <20171218105119.GY4062@6wind.com> References: <20171115155402.9967-1-xuemingl@mellanox.com> <20171209153923.19958-1-xuemingl@mellanox.com> <20171214153543.2d2ydissujk55cng@platinum> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171214153543.2d2ydissujk55cng@platinum> Subject: Re: [dpdk-dev] [PATCH v2] lib/cmdline: init CLI parsing memory X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Dec 2017 10:51:32 -0000 On Thu, Dec 14, 2017 at 04:35:45PM +0100, Olivier MATZ wrote: > Hi Xueming, > > On Sat, Dec 09, 2017 at 11:39:23PM +0800, Xueming Li wrote: > > Initialize result memory every time before parsing. Also save > > successfully parsed result before further ambiguous command detection to > > avoid result being tainted by later parsing. > > > > Signed-off-by: Xueming Li > > I'm ok with the content of the patch, but this has 2 be split in 2 > commits, which fixes different things. > > 1/ cmdline: fix dynamic tokens parsing > > [contains what Adrien suggested = all your patch but memset] > > When using dynamic tokens, the result buffer contains pointers > to some location inside the result buffer. When the content of > the temporary buffer is copied in the final one, these pointers > still point to the temporary buffer. > > This works until the temporary buffer is kept intact, but the > next commit introduces a memset() that breaks this assumption. > > This commit renames the buffers, and ensures that the pointers > point to the valid location, by recopying the buffer before > invoking f(). > > Fixes: 9b3fbb051d2e ("cmdline: fix parsing") > Cc: stable@dpdk.org > > > 2/ cmdline: avoid garbage in unused fields of parsed result > > [contains the memset() only] > > The result buffer was not initialized before parsing, inducing > garbage in unused fields or padding of the parsed structure. > > Initialize the result buffer each time before parsing. > > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org > > > Thoughts? > Adrien, are you also ok? Yes I fully agree, splitting this in two patches is also what I had in mind. Xueming, do you plan to submit v3 accordingly? -- Adrien Mazarguil 6WIND