[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] x86/ACPI: correct off-by-1 in SGI MMCFG check
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 17 Jul 2023 11:43:28 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7qEj9eXO7lsrKeTJfCmJD/7oAg8dzzkd/vp3P4GDAS0=; b=mxR5AKqKd7IvBTu8neEgRsWyH5jCPm8xiZebqlEzF+5ezT0AQAqKAko/eSb0WdeLMC6Did7W329JYaXGqwzDR1InlHJ536+LFZTAq++x54EF7NSIxAdLkkUuCh+SyXIFUMBBF8NQKUCSS8f9J+mdN4uypppO9i/SQIwzlMtECxVAs93t8Y98VYcB2WAXxmI72q/66Z9tqxEqfEb9qGGdDZ/mZG42cbBPXTKwazWkJ3DGz5sylZtHHCUBOdAGtqN7pFboMcCXfMwbu7YddM/7ak90zzgXklyJuu6td2dE69vFmrHCfyz5UZKD5LaGuXvDt6w+atFKrvZ3blhJDw92PA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MmKEmda/RnE6S7CzNwixU458Dds0wbfHiRMjAT1ZBPGNFe7fiMwPCozK8Ru17ogj59ZzG3vQ7ktfJIgkMucksoWALzpps/iQLz67jdLbTd0HbYnScEKQK+sMlCo4LGj/fX06DOEBTDNFeo9tb/4arhd9QUvKxtDPQzny+k7q+78ohg1pq+ZsHdBUOoRLgPwLouZVLvghEFFdSqLidpnVJPzpSvkjsR1UL12VJwfBuX1d3+Cpl5K43BHXeIxfRvYERXYZcaCev9d/Jn9k2Dj9VjUnCpq4mqw0ahMzBATKx8BdceN1knUFUVJWDn2VzYoCFfwYw8pI34kV6Q/HlM41+Q==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Simone Ballarin <simone.ballarin@xxxxxxxxxxx>, Gianluca Luparini <gianluca.luparini@xxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Mon, 17 Jul 2023 09:44:11 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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>
--- 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(
{
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(
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",
|