[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] x86/ACPI: correct off-by-1 in SGI MMCFG check



commit 168340ced86fcd020e6e44e0cf231cb31019bdf2
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Jul 18 12:39:29 2023 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jul 18 12:39:29 2023 +0200

    x86/ACPI: correct off-by-1 in SGI MMCFG check
    
    As supported by the printk() (deliberately made visible in context by
    also correcting a mis-indented return statement), "above 4GiB" is meant
    here. Avoid comparison with a constant to "escape" Misra rule 7.2
    complaints. (Note however that even up-to-date Linux, which is where we
    "inherited" this code from, still uses the very same off-by-1 check.)
    
    Fixes: 94ea0622c5b8 ("x86-64/mmcfg: relax base address restriction")
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/x86_64/acpi_mmcfg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_64/acpi_mmcfg.c b/xen/arch/x86/x86_64/acpi_mmcfg.c
index 2159c68189..7b09046229 100644
--- a/xen/arch/x86/x86_64/acpi_mmcfg.c
+++ b/xen/arch/x86/x86_64/acpi_mmcfg.c
@@ -50,7 +50,7 @@ static int __init acpi_mcfg_check_entry(struct 
acpi_table_mcfg *mcfg,
 {
     int year;
 
-    if (cfg->address < 0xFFFFFFFF)
+    if (cfg->address == (uint32_t)cfg->address)
         return 0;
 
     if (!strncmp(mcfg->header.oem_id, "SGI", 3))
@@ -59,7 +59,7 @@ static int __init acpi_mcfg_check_entry(struct 
acpi_table_mcfg *mcfg,
     if (mcfg->header.revision >= 1 &&
         dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) &&
         year >= 2010)
-            return 0;
+        return 0;
 
     printk(KERN_ERR "MCFG region for %04x:%02x-%02x at %#"PRIx64
                     " (above 4GB) ignored\n",
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.