Skip to content

Commit 77c7e1b

Browse files
mike-travisKAGA-KOKO
authored andcommitted
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: 1e61f5a ("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
1 parent b289645 commit 77c7e1b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

arch/x86/kernel/apic/x2apic_uv_x.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static union uvh_apicid uvh_apicid;
3333
static int uv_node_id;
3434

3535
/* Unpack AT/OEM/TABLE ID's to be NULL terminated strings */
36-
static u8 uv_archtype[UV_AT_SIZE];
36+
static u8 uv_archtype[UV_AT_SIZE + 1];
3737
static u8 oem_id[ACPI_OEM_ID_SIZE + 1];
3838
static u8 oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1];
3939

@@ -320,7 +320,7 @@ static int __init decode_arch_type(unsigned long ptr)
320320

321321
if (n > 0 && n < sizeof(uv_ate->archtype)) {
322322
pr_info("UV: UVarchtype received from BIOS\n");
323-
uv_stringify(UV_AT_SIZE, uv_archtype, uv_ate->archtype);
323+
uv_stringify(sizeof(uv_archtype), uv_archtype, uv_ate->archtype);
324324
return 1;
325325
}
326326
return 0;
@@ -378,7 +378,7 @@ static int __init uv_set_system_type(char *_oem_id, char *_oem_table_id)
378378
if (!early_get_arch_type())
379379

380380
/* If not use OEM ID for UVarchtype */
381-
uv_stringify(UV_AT_SIZE, uv_archtype, _oem_id);
381+
uv_stringify(sizeof(uv_archtype), uv_archtype, oem_id);
382382

383383
/* Check if not hubbed */
384384
if (strncmp(uv_archtype, "SGI", 3) != 0) {

0 commit comments

Comments
 (0)