[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] xen/arm: fix unitialized use warning


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Fri, 14 Apr 2023 14:57:14 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=Al+YVBo/rFHAhzjUVn24nt7jKtL9yJFrezw5/WN9ImY=; b=IQ2pGTKD88+zuMPdA4wet/rig4/wySpAUmtkJ7Q5wxyP6pjpmfiBYb++Pb0DR/D0U5d16BdI8fRwCQhCkSNJt4dY2iiCeV/0Mt7fMfj2ZSWzLGoovbWsJU3RBaJ1ffF1tzwxfWO1bhwG4NUF2+Ob0z22AhZi/kSlYS4PJUlyGHZTGa72zIe0hKWp/j6ub013MP5RlPGiONui/59ZqQKpfwjjtZlCOU/zM7fYBQ7vTzexQ/B215AapaPW2C/eCmlTC0Pq0Q5uy1FujaiZhwoEQV88c2h3Z13tyAT+2Cv1+7XU1RPvzb8PX5vVDIIkVM7iy//mXgvDSkpyuKePXdpkJA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A0H+L5MXch2APCSZxtNrT9Hh69YGQLyk+gOXnGelPqesd81rc4Z2e47jp+NOUEMMI2MTpPWPVdo08r2ZkO6tLYMNkV1YPQvhfvmeUYlGTCRUryXzK5n3N1pXFhyuh2BUVHS6n/UKpqFmvuj75sqoZl0Z9WR3KCu9rTITjmjtV/SPbHA2UDR6Y6qaliZJIoQopcotNipfEqdgxq8aT4vBn49Vc0o0OmNYBRDH0sCC1bmrcH0Lil78Qs5d5guAsSN9wpq6/xheCZMq+dzGD52N4PhbIV3Os4v1tLw7RL5/R4lhe/kmXrlNGhjhWjLLxuPz1LQGint5Tb/i6Cxz1TM2lA==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 14 Apr 2023 18:58:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When building the hypervisor with -Og, we encounter the following error:

arch/arm/domain_build.c: In function ‘make_cpus_node’:
arch/arm/domain_build.c:2040:12: error: ‘clock_valid’ may be used uninitialized 
[-Werror=maybe-uninitialized]
 2040 |         if ( clock_valid )
      |            ^
arch/arm/domain_build.c:1947:10: note: ‘clock_valid’ was declared here
 1947 |     bool clock_valid;
      |          ^~~~~~~~~~~
cc1: all warnings being treated as errors

Fix it by initializing the variable.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
---
See previous discussion here
https://lists.xenproject.org/archives/html/xen-devel/2022-10/msg00741.html
---
 xen/arch/arm/domain_build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 4f9d4f9d8867..18b350734a8e 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1944,7 +1944,7 @@ static int __init make_cpus_node(const struct domain *d, 
void *fdt)
     /* Placeholder for cpu@ + a 32-bit hexadecimal number + \0 */
     char buf[13];
     u32 clock_frequency;
-    bool clock_valid;
+    bool clock_valid = false;
     uint64_t mpidr_aff;
 
     dt_dprintk("Create cpus node\n");
-- 
2.40.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.