From: Ian Campbell <Ian.Campbell@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Dan Carpenter <error27@gmail.com>
Subject: Re: [Xen-devel] [PATCH 8/9] xen/enlighten: Fix compile warnings.
Date: Fri, 30 Sep 2011 09:10:51 +0100 [thread overview]
Message-ID: <1317370252.26672.224.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <1317325971-21603-9-git-send-email-konrad.wilk@oracle.com>
On Thu, 2011-09-29 at 20:52 +0100, Konrad Rzeszutek Wilk wrote:
> linux/arch/x86/xen/enlighten.c: In function ‘xen_start_kernel’:
> linux/arch/x86/xen/enlighten.c:226: warning: ‘cx’ may be used uninitialized in this function
> linux/arch/x86/xen/enlighten.c:240: note: ‘cx’ was declared here
Before 61f4237d5b005767a76f4f3694e68e6f78f392d9 we used to initialise cx
to zero before calling xen_cpuid.
947ccf9c3c30307b774af3666ee74fcd9f47f646 didn't put it back for some
reason.
Regardless I'm not sure how cx can be unused while {a,b,d}x apparently
are not. All four are passed to xen_cpuid(&ax, &bx, &cx, &dx) and even
if gcc were being clever and looking into xen_cpuid all four are in the
output constraints of the real cpuid asm call.
Oh, I see, ax and cx are also in the input side of the asm and ax is
initialised but cx is not and that is the use not the one later in
xen_init_cpuid_mask.
I think that even if cpuid leaf ax=1 happens not to use the subleaf
index in cx we'd be better to initialise cx=0 than use uninitialized_var
here.
Ian.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> arch/x86/xen/enlighten.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index 2d69617..9473861 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -237,7 +237,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
>
> static void __init xen_init_cpuid_mask(void)
> {
> - unsigned int ax, bx, cx, dx;
> + unsigned int ax, bx, uninitialized_var(cx), dx;
> unsigned int xsave_mask;
>
> cpuid_leaf1_edx_mask =
next prev parent reply other threads:[~2011-09-30 8:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 19:52 [PATCH] Xen bug-fixes for 3.2 (v1) Konrad Rzeszutek Wilk
2011-09-29 19:52 ` [PATCH 1/9] xen/pciback: Do not dereference psdev during printk when it is NULL Konrad Rzeszutek Wilk
2011-09-30 7:31 ` [Xen-devel] " Jan Beulich
2011-10-03 16:14 ` Konrad Rzeszutek Wilk
2011-09-29 19:52 ` [PATCH 2/9] xen/pciback: Return proper error code from sscanf Konrad Rzeszutek Wilk
2011-09-30 7:45 ` [Xen-devel] " Jan Beulich
2011-10-03 16:18 ` Konrad Rzeszutek Wilk
2011-09-29 19:52 ` [PATCH 3/9] xen/pciback: Check if the device is found instead of blindly assuming so Konrad Rzeszutek Wilk
2011-09-30 7:50 ` [Xen-devel] " Jan Beulich
2011-09-29 19:52 ` [PATCH 4/9] xen/events: BUG() when we can't allocate our event->irq array Konrad Rzeszutek Wilk
2011-09-30 7:55 ` [Xen-devel] " Ian Campbell
2011-10-03 16:21 ` Konrad Rzeszutek Wilk
2011-09-29 19:52 ` [PATCH 5/9] xen/events: Don't check the info for NULL as it is already done Konrad Rzeszutek Wilk
2011-09-29 19:52 ` [PATCH 6/9] xen/irq: If we fail during msi_capability_init return proper error code Konrad Rzeszutek Wilk
2011-09-29 19:52 ` [PATCH 7/9] xen/xenbus: Check before dereferencing it Konrad Rzeszutek Wilk
2011-09-30 8:01 ` [Xen-devel] " Ian Campbell
2011-10-03 16:26 ` Konrad Rzeszutek Wilk
2011-09-29 19:52 ` [PATCH 8/9] xen/enlighten: Fix compile warnings Konrad Rzeszutek Wilk
2011-09-30 8:10 ` Ian Campbell [this message]
2011-10-03 16:30 ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-09-29 19:52 ` [PATCH 9/9] xen/p2m/debugfs: Fix potential pointer exception Konrad Rzeszutek Wilk
2011-09-30 8:18 ` [Xen-devel] " Ian Campbell
2011-10-03 16:37 ` Konrad Rzeszutek Wilk
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=1317370252.26672.224.camel@zakaz.uk.xensource.com \
--to=ian.campbell@citrix.com \
--cc=error27@gmail.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®