From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yskoh@mellanox.com>
Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])
 by dpdk.org (Postfix) with ESMTP id C4B861B517
 for <stable@dpdk.org>; Fri, 30 Nov 2018 00:15:25 +0100 (CET)
Received: from Internal Mail-Server by MTLPINE1 (envelope-from
 yskoh@mellanox.com)
 with ESMTPS (AES256-SHA encrypted); 30 Nov 2018 01:21:16 +0200
Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx
 [10.101.0.96])
 by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wATNCW8e032075;
 Fri, 30 Nov 2018 01:15:21 +0200
From: Yongseok Koh <yskoh@mellanox.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: Wisam Jaddo <wisamm@mellanox.com>, Gaetan Rivet <gaetan.rivet@6wind.com>, 
 dpdk stable <stable@dpdk.org>
Date: Thu, 29 Nov 2018 15:11:34 -0800
Message-Id: <20181129231202.30436-100-yskoh@mellanox.com>
X-Mailer: git-send-email 2.11.0
In-Reply-To: <20181129231202.30436-1-yskoh@mellanox.com>
References: <20181129231202.30436-1-yskoh@mellanox.com>
Subject: [dpdk-stable] patch 'pci: fix parsing of address without function
	number' has been queued to LTS release 17.11.5
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Nov 2018 23:15:26 -0000

Hi,

FYI, your patch has been queued to LTS release 17.11.5

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/01/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Yongseok

---
>>From 64e8119d022160bc98a167bc0affc2b7043496a5 Mon Sep 17 00:00:00 2001
From: Thomas Monjalon <thomas@monjalon.net>
Date: Mon, 12 Nov 2018 00:58:56 +0100
Subject: [PATCH] pci: fix parsing of address without function number

[ upstream commit 31f19a9beb8d88b67be6e469404081eb834d199c ]

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

Fixes: af75078fece3 ("first public release")

Reported-by: Wisam Jaddo <wisamm@mellanox.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 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 0160fc1eb..ac0b1a6f0 100644
--- a/lib/librte_pci/rte_pci.c
+++ b/lib/librte_pci/rte_pci.c
@@ -59,6 +59,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.11.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-29 15:01:49.587285321 -0800
+++ 0100-pci-fix-parsing-of-address-without-function-number.patch	2018-11-29 15:01:45.264959000 -0800
@@ -1,8 +1,10 @@
-From 31f19a9beb8d88b67be6e469404081eb834d199c Mon Sep 17 00:00:00 2001
+From 64e8119d022160bc98a167bc0affc2b7043496a5 Mon Sep 17 00:00:00 2001
 From: Thomas Monjalon <thomas@monjalon.net>
 Date: Mon, 12 Nov 2018 00:58:56 +0100
 Subject: [PATCH] pci: fix parsing of address without function number
 
+[ upstream commit 31f19a9beb8d88b67be6e469404081eb834d199c ]
+
 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,
@@ -13,7 +15,6 @@
 	- GET_BLACKLIST_FIELD
 
 Fixes: af75078fece3 ("first public release")
-Cc: stable@dpdk.org
 
 Reported-by: Wisam Jaddo <wisamm@mellanox.com>
 Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
@@ -23,10 +24,10 @@
  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
+index 0160fc1eb..ac0b1a6f0 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)
+@@ -59,6 +59,10 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm)
  	uint8_t *u8 = _u8;
  	char *end;