From patchwork Tue Oct 8 01:14:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11178699 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8845517EE for ; Tue, 8 Oct 2019 01:16:21 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6444720679 for ; Tue, 8 Oct 2019 01:16:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ItALgK1j" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6444720679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHe5h-0001PA-Bt; Tue, 08 Oct 2019 01:15:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHe5f-0001On-DN for xen-devel@lists.xenproject.org; Tue, 08 Oct 2019 01:15:03 +0000 X-Inumbo-ID: 0dfeb334-e969-11e9-8c93-bc764e2007e4 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0dfeb334-e969-11e9-8c93-bc764e2007e4; Tue, 08 Oct 2019 01:15:03 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.hsd1.ca.comcast.net (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4968E20867; Tue, 8 Oct 2019 01:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570497302; bh=WP4pj+IslHYj1jI9EZ1W0JuwP7hGga0mmKu7DlziRM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ItALgK1jPzbfMrnObzm2bSxT9k6pyQFwmn1MZ+r8giWwj8gUlr2VaN0o2ucyhQVPK 43+XdtwC7yfw2JJ6k7X+OcOAaMxbp5zAW51VH8s86GkqyqRbMxEoKSeTdU5Q3tgKgM /vHIEiFbaqMI/xVg6CwRr9OK12UlraMa88afkQUE= From: Stefano Stabellini To: Julien.Grall@arm.com Date: Mon, 7 Oct 2019 18:14:59 -0700 Message-Id: <20191008011501.21038-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v2 1/3] xen/arm: fix buf size in make_cpus_node X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: jgross@suse.com, xen-devel@lists.xenproject.org, sstabellini@kernel.org, Volodymyr_Babchuk@epam.com, Stefano Stabellini MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The size of buf is calculated wrongly: the number is 64bit, not 32bit. Also the number is printed as a hexadecimal number, so we need 8 bytes for 32bit, not 10 bytes. As a result, it should be sizeof("cpu@") + 16 bytes for a 64-bit number + 1 byte for \0. Total = 21. Fixes: fafd682c3e (xen/arm: Create a fake cpus node in dom0 device tree) Signed-off-by: Stefano Stabellini --- Changes in v2: - patch added --- xen/arch/arm/domain_build.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 921b054520..60923a7051 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -788,8 +788,8 @@ static int __init make_cpus_node(const struct domain *d, void *fdt) unsigned int cpu; const void *compatible = NULL; u32 len; - /* Placeholder for cpu@ + a 32-bit number + \0 */ - char buf[15]; + /* Placeholder for cpu@ + a 64-bit number + \0 */ + char buf[21]; u32 clock_frequency; bool clock_valid; uint64_t mpidr_aff;