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

[PATCH 2/3] xen: silence maybe-unitialized warning


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Mon, 29 Jul 2024 10:24:16 -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 (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=CxhM1vltXOjPvL+T6lC6D2DCOSNH7I4CBgQMkOmeLEs=; b=Z5nTLZVom3hZnSpGTE2Al0nlihZrgZVau8f8nDhQnwbRtGFZVLtKbG90ctUaCh1PZ102PFcB132Sp+uhXSTUgDWYHjR5z6gX0J310PqhSPsCMXxz4RYl3tKgUz/1YEey4JSCTy05zw6ixwaE6aLAMTdSIPt0YT90Ud6l/z0O2xmVfO5iAIdc77HKWefhXOqB03l7wG3aDCzRXEw0ZfjdgMiPVDWAzrrU1BnSWANocGSkpsy5ZbyrFIgSBWuTeP6zWShIZ6eNsMICnuua0ZRwaTUjsYBUsOMqq5ux/B6SXFsJ6ucsWxN+lLST7f9RjgdqdZMuxWX1DOIbFj8bgG87rA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z69hYOhWRWrn9abDEaxwVR4AWFtb0CRtjBL/isMZBYJ/bNq7rkJVl/mBB+mISUcOQgigflr4n+aQAtccZAN8mxphfru5Kv8QM9LUCTLihfE/AIop3BE5LUvsWkhhjgBaXkb0+EaXta2PHfC5Z8lYR9dwoXfnON3RO5oK5ZtTs0uxlpCQxSg/gC0A4vDRW2laeAyrrs+T+1ssiAkOR8529gOsjILzv5SKskUhjYiMB45HO/mex3oILzReA8jOf0TJ5Jua8HjjCGchnmBWoWcwGQ3211WbHpvQml7lgtEC69qtN3buF9HQbF2FdUPmLMjQwnZLTrCWjPG8GRrekHHQ5A==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 29 Jul 2024 14:24:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When building with gcc with -finstrument-functions, optimization level
-O1, CONFIG_HYPFS=y and # CONFIG_HAS_SCHED_GRANULARITY is not set, the
the following build warning (error) is encountered:

common/sched/cpupool.c: In function ‘cpupool_gran_write’:
common/sched/cpupool.c:1220:26: error: ‘gran’ may be used uninitialized 
[-Werror=maybe-uninitialized]
 1220 |                      0 : cpupool_check_granularity(gran);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/sched/cpupool.c:1207:21: note: ‘gran’ declared here
 1207 |     enum sched_gran gran;
      |                     ^~~~

This is a false positive. Silence the warning (error) by initializing
the variable.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
---
 xen/common/sched/cpupool.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c
index 57dfee26f21f..3d02c7b70690 100644
--- a/xen/common/sched/cpupool.c
+++ b/xen/common/sched/cpupool.c
@@ -103,6 +103,7 @@ custom_param("sched-gran", sched_select_granularity);
 #elif defined(CONFIG_HYPFS)
 static int sched_gran_get(const char *str, enum sched_gran *mode)
 {
+    *mode = SCHED_GRAN_cpu;
     return -EINVAL;
 }
 #endif
-- 
2.45.2




 


Rackspace

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