From: Andy Shevchenko Date: Tue, 20 Mar 2018 18:08:00 +0000 (+0200) Subject: x86/PCI: Fix a potential regression when using dmi_get_bios_year() X-Git-Tag: v4.19~1348^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=47a9973d3ed8994589c845c8b1a293a475a549a9;p=platform%2Fkernel%2Flinux-rpi3.git x86/PCI: Fix a potential regression when using dmi_get_bios_year() dmi_get_bios_year() may return 0 when it cannot parse the BIOS date string. Previously this has been checked in pci_acpi_crs_quirks(). Update the code to restore old behaviour. Reported-by: Jean Delvare Signed-off-by: Andy Shevchenko Reviewed-by: Jean Delvare Reviewed-by: Rafael J. Wysocki Acked-by: Thomas Gleixner Cc: Bjorn Helgaas Cc: Linus Torvalds Cc: Lukas Wunner Cc: Peter Zijlstra Cc: Rafael J . Wysocki Cc: linux-acpi@vger.kernel.org Cc: linux-pci@vger.kernel.org Fixes: 69c42d493db4 ("x86/pci: Simplify code by using the new dmi_get_bios_year() helper") Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 00e60de..5559dca 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c @@ -140,7 +140,9 @@ static const struct dmi_system_id pci_crs_quirks[] __initconst = { void __init pci_acpi_crs_quirks(void) { - if ((dmi_get_bios_year() < 2008) && (iomem_resource.end <= 0xffffffff)) + int year = dmi_get_bios_year(); + + if (year >= 0 && year < 2008 && iomem_resource.end <= 0xffffffff) pci_use_crs = false; dmi_check_system(pci_crs_quirks);