From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 840313256 for ; Mon, 12 Nov 2018 10:29:26 +0100 (CET) Received: by mail-wr1-f65.google.com with SMTP id j17-v6so8441061wrq.11 for ; Mon, 12 Nov 2018 01:29:26 -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:content-transfer-encoding:in-reply-to :user-agent; bh=zrVQV39hPtGqXIG3CtP8zEuppIn8iPevaD7GQcx8SAE=; b=j+kiegObnXRRc/uPbTKbWs+SBx8ZTj3TfOsZF4ou7tyL0JQQfnXo4wgIbYKk2x9GjS YT+AzKlBvGv8tj6RhdJTC1GhvpvDkus+hI1YgQB3ZoQBxKWW88c4ioW92Ynr+VXJWAOw bp66DZiESavHmFiz5e3v8mgJGTbchviNPMPX7BVF3YQfTUnLCpqvgGB8owKAqusKDz3i +HHzmaKe9P18myJsqGHjPEu7XSnZtRTAdIicms2UsiSiHN+8mGyKIZ/WSkXH8bUBOF8f 830aqwXFazuLjYu2AhByEM7pHevnypW3dtlan6hCLTKD9VUUUlRCXqTubC/EmMRZBIcK V5UA== 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:content-transfer-encoding :in-reply-to:user-agent; bh=zrVQV39hPtGqXIG3CtP8zEuppIn8iPevaD7GQcx8SAE=; b=Vhd+AZsxLcE7H2eajaE8tw5SRSssBtaFxKD8dRvyimLytMpic8NjXfd37PfN3po8Mz KLyy0cwmAKMIXRrY5Kr/rg5Eab0hLYFJp6HHPDbgRCGTXwqUVmBfUv0hhnfalzE5hwUu FYbmRyyuwgUBboj8GWuGcLZCnkm7969N/MvQnMUEZqIJ7dcbzUdefqACCxijYUwpdxhO 4LxtQox2K4ex6X3S0pRM3MoLyfQfAJ+6Q91AvrO8GgsvPZIaYn0NYeDRutMk0Umsu4cI VOIMMDE0uqm/ea8Z7ZQ20UV7ij8ROw9UWaHa/feSnZnUFKuEPyzuBpKo8TkYrpMP0qiO TfmA== X-Gm-Message-State: AGRZ1gJGlqs9ilpSWlqq1b1QamswMocdwIRbdL7Fsz5NKEQyJsYaUP40 lQv/SjMSJ1/QVU8ZHDqV0AFyl1jlzAU= X-Google-Smtp-Source: AJdET5eE3lhqYtFcuc/vVQm38rEMWqDL5MKVJOqUHmRXufVODzt+Jw0PWJZWV5vX68WXaiJsIH5AtQ== X-Received: by 2002:a5d:634f:: with SMTP id b15-v6mr250479wrw.14.1542014966022; Mon, 12 Nov 2018 01:29:26 -0800 (PST) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id f12-v6sm3228734wru.63.2018.11.12.01.29.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Nov 2018 01:29:25 -0800 (PST) Date: Mon, 12 Nov 2018 10:29:05 +0100 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Thomas Monjalon Cc: dev@dpdk.org, wisamm@mellanox.com, stable@dpdk.org Message-ID: <20181112092905.g5vxszu5okxz4pzn@bidouze.vm.6wind.com> References: <20181111235856.31429-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181111235856.31429-1-thomas@monjalon.net> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-stable] [PATCH] pci: fix parsing of address without function number X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2018 09:29:27 -0000 On Mon, Nov 12, 2018 at 12:58:56AM +0100, Thomas Monjalon wrote: > If the last part of the PCI address (function number) is missing, > the parsing was successful, assuming function 0. > The call to strtoul is not returning an error in such a case, > so an explicit check is inserted before. > > This bug has always been there in older parsing macros: > - GET_PCIADDR_FIELD > - GET_BLACKLIST_FIELD > Returning 0, that's understandable, but errno not being set is rather lame from strtoul. > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org > > Reported-by: Wisam Jaddo > Signed-off-by: Thomas Monjalon Acked-by: Gaetan Rivet > --- > lib/librte_pci/rte_pci.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c > index 530738dbd..f400178bb 100644 > --- a/lib/librte_pci/rte_pci.c > +++ b/lib/librte_pci/rte_pci.c > @@ -30,6 +30,10 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm) > uint8_t *u8 = _u8; > char *end; > > + /* empty string is an error though strtoul() returns 0 */ > + if (*in == '\0') > + return NULL; > + > errno = 0; > val = strtoul(in, &end, 16); > if (errno != 0 || end[0] != dlm || val > UINT8_MAX) { > -- > 2.19.0 > -- Gaëtan Rivet 6WIND