From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7BCFDA04B0 for ; Sun, 23 Aug 2020 15:07:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 255071C0B7; Sun, 23 Aug 2020 15:07:07 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id DDC731BFD7 for ; Sun, 23 Aug 2020 15:07:02 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from talshn@nvidia.com) with SMTP; 23 Aug 2020 16:07:02 +0300 Received: from nvidia.com (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 07ND71HY007725; Sun, 23 Aug 2020 16:07:01 +0300 From: Tal Shnaiderman To: dev@dpdk.org Cc: thomas@monjalon.net, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com, ranjit.menon@intel.com, navasile@linux.microsoft.com, harini.ramakrishnan@microsoft.com, Tal Shnaiderman , stable@dpdk.org Date: Sun, 23 Aug 2020 16:06:04 +0300 Message-Id: <20200823130604.9992-1-talshn@nvidia.com> X-Mailer: git-send-email 2.16.1.windows.4 Subject: [dpdk-stable] [PATCH] bus/pci: fix hardware ids parsing on Windows 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Tal Shnaiderman Swap subsystem vendor id and subsystem device id. Parse the SPDRP_HARDWAREID string with correct type values. Fixes: b762221ac24 ("bus/pci: support Windows with bifurcated drivers") Cc: stable@dpdk.org Signed-off-by: Tal Shnaiderman --- drivers/bus/pci/windows/pci.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c index 489aa7902a..c80bd55716 100644 --- a/drivers/bus/pci/windows/pci.c +++ b/drivers/bus/pci/windows/pci.c @@ -270,17 +270,18 @@ static int parse_pci_hardware_id(const char *buf, struct rte_pci_id *pci_id) { int ids = 0; - uint16_t vendor_id, device_id, subvendor_id = 0; + uint16_t vendor_id, device_id; + uint32_t subvendor_id = 0; - ids = sscanf_s(buf, "PCI\\VEN_%x&DEV_%x&SUBSYS_%x", &vendor_id, - &device_id, &subvendor_id); + ids = sscanf_s(buf, "PCI\\VEN_%" PRIx16 "&DEV_%" PRIx16 "&SUBSYS_%" + PRIx32, &vendor_id, &device_id, &subvendor_id); if (ids != 3) return -1; pci_id->vendor_id = vendor_id; pci_id->device_id = device_id; - pci_id->subsystem_vendor_id = subvendor_id >> 16; - pci_id->subsystem_device_id = subvendor_id & 0xffff; + pci_id->subsystem_device_id = subvendor_id >> 16; + pci_id->subsystem_vendor_id = subvendor_id & 0xffff; return 0; } -- 2.16.1.windows.4