From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:36050 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750789AbdEBK4B (ORCPT ); Tue, 2 May 2017 06:56:01 -0400 Received: by mail-pf0-f195.google.com with SMTP id v14so32327233pfd.3 for ; Tue, 02 May 2017 03:56:01 -0700 (PDT) Date: Tue, 2 May 2017 06:55:40 -0400 From: Sujith Pandel To: linux-pci@vger.kernel.org Cc: Shai@ScaleMP.com, sujithpshankar@gmail.com, Narendra_K@Dell.com Subject: [PATCH] Add PCI domain number check to find_smbios_instance_string Message-ID: <20170502105540.GA36230@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-pci-owner@vger.kernel.org List-ID: The function 'find_smbios_instance_string' does not consider the PCI domain number. As a result, SMBIOS type 41 device type instance would be exported to sysfs for all the PCI domains which have a PCI device with same bus/device/function, though PCI bus/device/func from a specific PCI domain has SMBIOS type 41 device type instance defined. Address the issue by making 'find_smbios_instance_string' function check PCI domain number as well. Reported-by: Shai Fultheim Suggested-by: Shai Fultheim Signed-off-by: Sujith Pandel Signed-off-by: Narendra K Tested-by: Shai Fultheim --- drivers/pci/pci-label.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c index 5135737..1d828a6 100644 --- a/drivers/pci/pci-label.c +++ b/drivers/pci/pci-label.c @@ -43,9 +43,11 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf, { const struct dmi_device *dmi; struct dmi_dev_onboard *donboard; + int domain_nr; int bus; int devfn; + domain_nr = pci_domain_nr(pdev->bus); bus = pdev->bus->number; devfn = pdev->devfn; @@ -53,8 +55,9 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf, while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD, NULL, dmi)) != NULL) { donboard = dmi->device_data; - if (donboard && donboard->bus == bus && - donboard->devfn == devfn) { + if (donboard && donboard->segment == domain_nr && + donboard->bus == bus && + donboard->devfn == devfn) { if (buf) { if (attribute == SMBIOS_ATTR_INSTANCE_SHOW) return scnprintf(buf, PAGE_SIZE, -- 1.8.3.1