xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>
Subject: [PATCH 3/7] x86/sysctl: Make arch_do_sysctl() compile at -Og
Date: Mon, 19 Apr 2021 15:01:28 +0100	[thread overview]
Message-ID: <20210419140132.16909-4-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20210419140132.16909-1-andrew.cooper3@citrix.com>

When compiling at -Og:

  sysctl.c: In function ‘arch_do_sysctl’:
  sysctl.c:197:19: error: ‘hcpu’ may be used uninitialized in this function[-Werror=maybe-uninitialized]
               ret = continue_hypercall_on_cpu(0, fn, hcpu);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  sysctl.c: In function ‘arch_do_sysctl’:
  sysctl.c:197:19: error: ‘fn’ may be used uninitialized in this function[-Werror=maybe-uninitialized]
               ret = continue_hypercall_on_cpu(0, fn, hcpu);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These look to be caused by insufficient analysis around the !ret conditionals.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
---
 xen/arch/x86/sysctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index aff52a13f3..6ac09bac79 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -150,8 +150,8 @@ long arch_do_sysctl(
         unsigned int cpu = sysctl->u.cpu_hotplug.cpu;
         unsigned int op  = sysctl->u.cpu_hotplug.op;
         bool plug;
-        long (*fn)(void *);
-        void *hcpu;
+        long (*fn)(void *) = NULL;
+        void *hcpu = NULL;
 
         switch ( op )
         {
-- 
2.11.0



  parent reply	other threads:[~2021-04-19 14:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 14:01 [PATCH 0/7] xen: Switch to using -Og for debug builds Andrew Cooper
2021-04-19 14:01 ` [PATCH 1/7] xen/arm: Make make_cpus_node() compile at -Og Andrew Cooper
2021-04-22 18:20   ` Julien Grall
2021-04-19 14:01 ` [PATCH 2/7] x86/shim: Fix compilation " Andrew Cooper
2021-04-19 14:01 ` Andrew Cooper [this message]
2021-04-19 14:01 ` [PATCH 4/7] x86/irq: Make create_irq() compile " Andrew Cooper
2021-04-19 14:01 ` [PATCH 5/7] xen/efi: Make efi_start() " Andrew Cooper
2021-04-19 14:01 ` [PATCH 6/7] x86/shadow: Make _shadow_prealloc() " Andrew Cooper
2021-04-22  7:52   ` Tim Deegan
2021-04-19 14:01 ` [PATCH 7/7] xen: Use -Og for debug builds when available Andrew Cooper
2021-04-19 15:45 ` [PATCH 0/7] xen: Switch to using -Og for debug builds Jan Beulich
2021-04-21  9:31   ` Andrew Cooper
2021-04-21  9:51     ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210419140132.16909-4-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [PATCH 3/7] x86/sysctl: Make arch_do_sysctl() compile at -Og' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).