* [PATCH] x86/platform/uv: UV5 Fix copied output archtype
@ 2020-11-11 1:04 Mike Travis
2020-11-12 15:48 ` Steve Wahl
2020-11-12 23:06 ` [tip: x86/urgent] x86/platform/uv: Fix copied UV5 " tip-bot2 for Mike Travis
0 siblings, 2 replies; 3+ messages in thread
From: Mike Travis @ 2020-11-11 1:04 UTC (permalink / raw)
To: Borislav Petkov, Thomas Gleixner, Ingo Molnar, Steve Wahl,
H. Peter Anvin, x86
Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, linux-kernel
A test shows that the output contains a space:
# cat /proc/sgi_uv/archtype
NSGI4 U/UVX
Remove that embedded space by copying the "trimmed" buffer instead of the
untrimmed input character list. Use sizeof to remove size dependency
on copy out length. Increase output buffer size by one character just
in case BIOS sends an 8 character string for archtype.
Fixes: 1e61f5a95f191 (Add and decode Arch Type in UVsystab)
Signed-off-by: Mike Travis <mike.travis@hpe.com>
---
arch/x86/kernel/apic/x2apic_uv_x.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 3115caa7d7d0..1b98f8c12b96 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -33,7 +33,7 @@ static union uvh_apicid uvh_apicid;
static int uv_node_id;
/* Unpack AT/OEM/TABLE ID's to be NULL terminated strings */
-static u8 uv_archtype[UV_AT_SIZE];
+static u8 uv_archtype[UV_AT_SIZE + 1];
static u8 oem_id[ACPI_OEM_ID_SIZE + 1];
static u8 oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1];
@@ -320,7 +320,7 @@ static int __init decode_arch_type(unsigned long ptr)
if (n > 0 && n < sizeof(uv_ate->archtype)) {
pr_info("UV: UVarchtype received from BIOS\n");
- uv_stringify(UV_AT_SIZE, uv_archtype, uv_ate->archtype);
+ uv_stringify(sizeof(uv_archtype), uv_archtype, uv_ate->archtype);
return 1;
}
return 0;
@@ -378,7 +378,7 @@ static int __init uv_set_system_type(char *_oem_id, char *_oem_table_id)
if (!early_get_arch_type())
/* If not use OEM ID for UVarchtype */
- uv_stringify(UV_AT_SIZE, uv_archtype, _oem_id);
+ uv_stringify(sizeof(uv_archtype), uv_archtype, oem_id);
/* Check if not hubbed */
if (strncmp(uv_archtype, "SGI", 3) != 0) {
--
2.21.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/platform/uv: UV5 Fix copied output archtype
2020-11-11 1:04 [PATCH] x86/platform/uv: UV5 Fix copied output archtype Mike Travis
@ 2020-11-12 15:48 ` Steve Wahl
2020-11-12 23:06 ` [tip: x86/urgent] x86/platform/uv: Fix copied UV5 " tip-bot2 for Mike Travis
1 sibling, 0 replies; 3+ messages in thread
From: Steve Wahl @ 2020-11-12 15:48 UTC (permalink / raw)
To: Mike Travis
Cc: Borislav Petkov, Thomas Gleixner, Ingo Molnar, Steve Wahl,
H. Peter Anvin, x86, Dimitri Sivanich, Russ Anderson,
linux-kernel
On Tue, Nov 10, 2020 at 07:04:18PM -0600, Mike Travis wrote:
> A test shows that the output contains a space:
> # cat /proc/sgi_uv/archtype
> NSGI4 U/UVX
> Remove that embedded space by copying the "trimmed" buffer instead of the
> untrimmed input character list. Use sizeof to remove size dependency
> on copy out length. Increase output buffer size by one character just
> in case BIOS sends an 8 character string for archtype.
>
> Fixes: 1e61f5a95f191 (Add and decode Arch Type in UVsystab)
>
> Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
> ---
> arch/x86/kernel/apic/x2apic_uv_x.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
> index 3115caa7d7d0..1b98f8c12b96 100644
> --- a/arch/x86/kernel/apic/x2apic_uv_x.c
> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
> @@ -33,7 +33,7 @@ static union uvh_apicid uvh_apicid;
> static int uv_node_id;
>
> /* Unpack AT/OEM/TABLE ID's to be NULL terminated strings */
> -static u8 uv_archtype[UV_AT_SIZE];
> +static u8 uv_archtype[UV_AT_SIZE + 1];
> static u8 oem_id[ACPI_OEM_ID_SIZE + 1];
> static u8 oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1];
>
> @@ -320,7 +320,7 @@ static int __init decode_arch_type(unsigned long ptr)
>
> if (n > 0 && n < sizeof(uv_ate->archtype)) {
> pr_info("UV: UVarchtype received from BIOS\n");
> - uv_stringify(UV_AT_SIZE, uv_archtype, uv_ate->archtype);
> + uv_stringify(sizeof(uv_archtype), uv_archtype, uv_ate->archtype);
> return 1;
> }
> return 0;
> @@ -378,7 +378,7 @@ static int __init uv_set_system_type(char *_oem_id, char *_oem_table_id)
> if (!early_get_arch_type())
>
> /* If not use OEM ID for UVarchtype */
> - uv_stringify(UV_AT_SIZE, uv_archtype, _oem_id);
> + uv_stringify(sizeof(uv_archtype), uv_archtype, oem_id);
>
> /* Check if not hubbed */
> if (strncmp(uv_archtype, "SGI", 3) != 0) {
> --
> 2.21.0
>
--
Steve Wahl, Hewlett Packard Enterprise
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: x86/urgent] x86/platform/uv: Fix copied UV5 output archtype
2020-11-11 1:04 [PATCH] x86/platform/uv: UV5 Fix copied output archtype Mike Travis
2020-11-12 15:48 ` Steve Wahl
@ 2020-11-12 23:06 ` tip-bot2 for Mike Travis
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Mike Travis @ 2020-11-12 23:06 UTC (permalink / raw)
To: linux-tip-commits
Cc: Mike Travis, Thomas Gleixner, Steve Wahl, x86, linux-kernel
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 77c7e1bc060deab6430f1dff5922ccd3093d9776
Gitweb: https://git.kernel.org/tip/77c7e1bc060deab6430f1dff5922ccd3093d9776
Author: Mike Travis <mike.travis@hpe.com>
AuthorDate: Tue, 10 Nov 2020 19:04:18 -06:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 13 Nov 2020 00:00:31 +01:00
x86/platform/uv: Fix copied UV5 output archtype
A test shows that the output contains a space:
# cat /proc/sgi_uv/archtype
NSGI4 U/UVX
Remove that embedded space by copying the "trimmed" buffer instead of the
untrimmed input character list. Use sizeof to remove size dependency on
copy out length. Increase output buffer size by one character just in case
BIOS sends an 8 character string for archtype.
Fixes: 1e61f5a95f19 ("Add and decode Arch Type in UVsystab")
Signed-off-by: Mike Travis <mike.travis@hpe.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Link: https://lore.kernel.org/r/20201111010418.82133-1-mike.travis@hpe.com
---
arch/x86/kernel/apic/x2apic_uv_x.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 3115caa..1b98f8c 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -33,7 +33,7 @@ static union uvh_apicid uvh_apicid;
static int uv_node_id;
/* Unpack AT/OEM/TABLE ID's to be NULL terminated strings */
-static u8 uv_archtype[UV_AT_SIZE];
+static u8 uv_archtype[UV_AT_SIZE + 1];
static u8 oem_id[ACPI_OEM_ID_SIZE + 1];
static u8 oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1];
@@ -320,7 +320,7 @@ static int __init decode_arch_type(unsigned long ptr)
if (n > 0 && n < sizeof(uv_ate->archtype)) {
pr_info("UV: UVarchtype received from BIOS\n");
- uv_stringify(UV_AT_SIZE, uv_archtype, uv_ate->archtype);
+ uv_stringify(sizeof(uv_archtype), uv_archtype, uv_ate->archtype);
return 1;
}
return 0;
@@ -378,7 +378,7 @@ static int __init uv_set_system_type(char *_oem_id, char *_oem_table_id)
if (!early_get_arch_type())
/* If not use OEM ID for UVarchtype */
- uv_stringify(UV_AT_SIZE, uv_archtype, _oem_id);
+ uv_stringify(sizeof(uv_archtype), uv_archtype, oem_id);
/* Check if not hubbed */
if (strncmp(uv_archtype, "SGI", 3) != 0) {
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-12 23:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 1:04 [PATCH] x86/platform/uv: UV5 Fix copied output archtype Mike Travis
2020-11-12 15:48 ` Steve Wahl
2020-11-12 23:06 ` [tip: x86/urgent] x86/platform/uv: Fix copied UV5 " tip-bot2 for Mike Travis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®