From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id 940BA1B017 for ; Tue, 19 Dec 2017 11:15:51 +0100 (CET) Received: by mail-wr0-f194.google.com with SMTP id f8so7753557wre.4 for ; Tue, 19 Dec 2017 02:15:51 -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=QnAtuLblSERYalgfkwsq0c1Iicl19oDOypljPaYySBg=; b=m/QuBhRB9399qSN0Vq8dbp85orlO/NPGHPAcHTkw7+7sK0bZCJi2G94ggeb/z5/ODv N/vaffKcZ4KCr6cPPFXrzfoCLIWe+vdy9osESSNb3VXud6xftj8eiNs6oYmEYBBmC6DF iXcB/MGt3jgACNhz6xFWJSeBAEgXm2ibPXbMJ2yS6k61ExyGfj1DZtNCWBUm2uksqyF+ ixkp1FiQ7TYCclss8gyYi4ME7hHQ0MQbq2UVPcu9Q2Co3aFrmNyZIO6DG1MVb3+qU3ma 3788MRRC0RT507Z3Q1sdnJpPQnf6OWiWd1zj4hcVWusu6xREpLdeqEbqXt1oFT2jqXyU xrwA== 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=QnAtuLblSERYalgfkwsq0c1Iicl19oDOypljPaYySBg=; b=GP6XmOEN7EDFzDIWU4g0hvUrhAIsgh18Nsa1xQHyLMZkAOdIsZ1ZPoEqvSrGd4crqm 6iPFptSIogp3+pveTHOydu1co3x2ZWK/4KEOijR31J33y8izjX4aIY5mUlqAUlALOzXt oOFAibJKJZ2WpJJXJfSevUhW+mZmcl2OHGMvtUfoH7VgLkNE8ltUR7H6ZAQfumXiLm1k LztP9FAUv2fYSvdVnyVwakMVcAyLLj/UA1QY+LxHSwBAZt7kyL26rY3kSefCLMvkD5rc k5GxDkpxgFbDYqv6a7lTCtGE4eU+XlbJnQoW0PlYXcgQEFKoLR8FL2G+W+zQco2JZHGI b/XQ== X-Gm-Message-State: AKGB3mJgsbTUObXRXRmL6wIVlx5GbN0UxNW2ftT1obkqDvih7VGXqzBg PA/ee9adKsSpfal7ArnxuJBjxA== X-Google-Smtp-Source: ACJfBovGU2Y3UaObYyZq7G26iuznxgIh3Ri3q4gLTIle7Khm2FFNefPDqR2jsXfWavV1xy+g6z0Ztw== X-Received: by 10.223.188.141 with SMTP id g13mr4485916wrh.169.1513678551317; Tue, 19 Dec 2017 02:15:51 -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 y28sm11708809edi.95.2017.12.19.02.15.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Dec 2017 02:15:50 -0800 (PST) Date: Tue, 19 Dec 2017 11:15:38 +0100 From: Adrien Mazarguil To: Bruce Richardson Cc: Stephen Hemminger , Ferruh Yigit , dev@dpdk.org Message-ID: <20171219101538.GC5377@6wind.com> References: <20171124172132.GW4062@6wind.com> <20171218162443.12971-1-adrien.mazarguil@6wind.com> <20171218162443.12971-3-adrien.mazarguil@6wind.com> <20171218103412.342adcbc@xeon-e3> <20171218202341.GF4062@6wind.com> <20171219095326.GA7384@bricha3-MOBL3.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171219095326.GA7384@bricha3-MOBL3.ger.corp.intel.com> Subject: Re: [dpdk-dev] [PATCH v1 2/3] net/hyperv: implement core functionality 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: Tue, 19 Dec 2017 10:15:51 -0000 On Tue, Dec 19, 2017 at 09:53:27AM +0000, Bruce Richardson wrote: > On Mon, Dec 18, 2017 at 09:23:41PM +0100, Adrien Mazarguil wrote: > > On Mon, Dec 18, 2017 at 10:34:12AM -0800, Stephen Hemminger wrote: > > > On Mon, 18 Dec 2017 17:46:23 +0100 > > > Adrien Mazarguil wrote: > > > > > > > > +static int > > > > +hyperv_iface_is_netvsc(const struct if_nameindex *iface) > > > > +{ > > > > + static const char temp[] = "/sys/class/net/%s/device/class_id"; > > > > + char path[snprintf(NULL, 0, temp, iface->if_name) + 1]; > > > > > > Doing this snprintf is gross. Either use PATH_MAX or asprintf > > > > I don't think allocating more stack space than necessary or on the heap with > > a possible allocation failure to deal with is any better, sorry. > > > > Prove this snprintf() call can fail and you'll have a point. > > > While I get your point, I'd tend to go with Stephen's view on this that > it's looking a bit "gross". What's the problem with allocating a bit > more stack space for it? Well, apart from making a stand, none really. Too "unusual" perhaps, but I don't think "gross" is a valid argument to reject a perfectly valid piece of code that doesn't rely on obscure knowledge nor weird side effects. I'll update this in v2 to make it look more acceptable in any case. -- Adrien Mazarguil 6WIND