Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4443083pxb; Tue, 10 Nov 2020 17:08:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvr2IDPQynD+VxiXdPisinsp+moK/HCIB2R3dEFraiOtXp2eTisQGmDYlDfeXwTWeNVaMM X-Received: by 2002:aa7:ccd2:: with SMTP id y18mr24353595edt.11.1605056893832; Tue, 10 Nov 2020 17:08:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605056893; cv=none; d=google.com; s=arc-20160816; b=xY5VMaLbChwIPdThJQ9WLz58UWOYr6937VGOuWMW/zewRpdgDngf5Li2yDK4e2OD1M 6tbyobH4hmUjo9TivQE9x+c+jK7ncvLUt20q4Gn2hyLYGrTbho42LQTXCjR5s98iG3dh OTQnNuhm/BSug0aiEHrfSzwbBcC4s7JHSNl+Yb7+kLEKwKJIe9b5IpyLS+9al7JOw6zL YAS7RpJtZ9LTp+ZYfCgeicyVkdCKkPAUNw1SxKpGW5nwWL7uAwNTTKjalwwXjh9W9US2 A5a2Y4rOvpd7DisHmRAwzxVg7LHGyLOGwD5AzBoHHI7rwVjRfFNha0tMm0A/f2cs4ww3 K+Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gj4FGYPPEFu5y5//Sn6dcPRQx9fXFoM5v85DlCNQGHk=; b=Vutt6nBf6Fjg7tL1s6HMzN/WyDKmxTqcJ+90ipamBQ+LONchlAbWN3XUW2WOn3Y7IA Dv0wHhgCBORuysYgKilvsD9F7gFJPtozgVneXhCMHPxsxwktX3Oe7L6KehmgRrlfNZ0U +5Q5AjqipqdcG2yM1poOjM4zud6HTM6bDmgFp/zym6rmyDuGm017MS4K5OQB3r/rnBcd UICU1TuXosh/HA3ws5HV34p3ZHXIHAftiKgR8PFp+63PucO9OSYDFoPqPgBgIht6Avso ooop0sR8zWgObvCQUFL87D6IS1qbVcBAevWISD+aMVJc+If1taOJZ3hAemx2qAV4tEk1 W6Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=ZbNwdIHh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hpe.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si335160edm.295.2020.11.10.17.07.30; Tue, 10 Nov 2020 17:08:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=ZbNwdIHh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hpe.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732409AbgKKBFB (ORCPT + 99 others); Tue, 10 Nov 2020 20:05:01 -0500 Received: from mx0b-002e3701.pphosted.com ([148.163.143.35]:34296 "EHLO mx0b-002e3701.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731982AbgKKBFB (ORCPT ); Tue, 10 Nov 2020 20:05:01 -0500 Received: from pps.filterd (m0150244.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0wJIF008620; Wed, 11 Nov 2020 01:04:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pps0720; bh=gj4FGYPPEFu5y5//Sn6dcPRQx9fXFoM5v85DlCNQGHk=; b=ZbNwdIHhcOLLmpF/SqzMuOYiVsAu4h/2+1AlvdazhBovEgclDgMc6CHlmgzd2hCO5pqb i17awatACudMYQeE+CH5LYgnsPpK91+gDS8vT9b4yrxDZvhCteX8TsgmCYcR9XISDTBc mKsAXgzOaduTaHw2PT0KU7qdUnoQIcmuPW5uqkTYvgWEZAti1VxkTQi8R0AAYfe6mtfL WQVVaUWXUtT6wbl6EmSdGRuunFlZyyJyQ15AgDz9+faTDInYw4ZEPlSoVYuRyuoUh7f2 BeKZuY3CvCH/lcMm/kH7g9ckFPNHVIv7qETDAc1EGMwymi06HJkU8CmG1rl45oFiM41n sQ== Received: from g4t3425.houston.hpe.com (g4t3425.houston.hpe.com [15.241.140.78]) by mx0b-002e3701.pphosted.com with ESMTP id 34nmh6w17n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Nov 2020 01:04:28 +0000 Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g4t3425.houston.hpe.com (Postfix) with ESMTP id 3A98AA1; Wed, 11 Nov 2020 01:04:28 +0000 (UTC) Received: from dog.eag.rdlabs.hpecorp.net (dog.eag.rdlabs.hpecorp.net [128.162.243.181]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id 4D9B14C; Wed, 11 Nov 2020 01:04:27 +0000 (UTC) From: Mike Travis To: Borislav Petkov , Thomas Gleixner , Ingo Molnar , Steve Wahl , "H. Peter Anvin" , x86@kernel.org Cc: Mike Travis , Dimitri Sivanich , Russ Anderson , linux-kernel@vger.kernel.org Subject: [PATCH] x86/platform/uv: UV5 Fix copied output archtype Date: Tue, 10 Nov 2020 19:04:18 -0600 Message-Id: <20201111010418.82133-1-mike.travis@hpe.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-10_09:2020-11-10,2020-11-10 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110002 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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