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 75C2F1B013 for ; Tue, 19 Dec 2017 10:53:33 +0100 (CET) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2017 01:53:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,425,1508828400"; d="scan'208";a="13538988" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.106]) by orsmga003.jf.intel.com with SMTP; 19 Dec 2017 01:53:29 -0800 Received: by (sSMTP sendmail emulation); Tue, 19 Dec 2017 09:53:28 +0000 Date: Tue, 19 Dec 2017 09:53:27 +0000 From: Bruce Richardson To: Adrien Mazarguil Cc: Stephen Hemminger , Ferruh Yigit , dev@dpdk.org Message-ID: <20171219095326.GA7384@bricha3-MOBL3.ger.corp.intel.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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171218202341.GF4062@6wind.com> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.9.1 (2017-09-22) 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 09:53:33 -0000 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? /Bruce