All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Richter <robert.richter@amd.com>
To: "mingo@redhat.com" <mingo@redhat.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@elte.hu" <mingo@elte.hu>
Cc: "linux-tip-commits@vger.kernel.org"  <linux-tip-commits@vger.kernel.org>
Subject: Re: [tip:perf/urgent] x86/oprofile: Fix uninitialized variable use in debug printk
Date: Mon, 25 Oct 2010 12:21:11 +0200	[thread overview]
Message-ID: <20101025102110.GJ5969@erda.amd.com> (raw)
In-Reply-To: <tip-2c78ffeca98fcd5a1dfd4a322438944506ed5e64@git.kernel.org>

On 25.10.10 02:52:03, tip-bot for Ingo Molnar wrote:
> Commit-ID:  2c78ffeca98fcd5a1dfd4a322438944506ed5e64
> Gitweb:     http://git.kernel.org/tip/2c78ffeca98fcd5a1dfd4a322438944506ed5e64
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Mon, 25 Oct 2010 08:41:09 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Mon, 25 Oct 2010 08:46:20 +0200
> 
> x86/oprofile: Fix uninitialized variable use in debug printk
> 
> Stephen Rothwell reported this build warning:
> 
>   arch/x86/oprofile/op_model_amd.c: In function 'ibs_eilvt_valid':
>   arch/x86/oprofile/op_model_amd.c:289: warning: 'offset' may be used uninitialized in this function
> 
> And correctly observed that indeed the variable is used uninitialized in
> this function. The result of this bug can be a debug printk with a bogus
> value.
> 
> Also fix a few more small details that made this function hard to read
> and which probably contributed to the bug being introduced to begin with:
> 
>  - Use more symmetric error conditions
> 
>  - Remove the !0 obfuscation
> 
>  - Add newlines to the printk output
> 
>  - Remove bogus linebreaks in printk strings and elsewhere

Ingo, thanks for changing this, it all looks good to me, though we
actually don't have to print the offset as the valid bit is not set.

For some reason I didn't catch the warning:

...
  LD      arch/x86/kernel/acpi/built-in.o
  CC      arch/x86/oprofile/op_model_amd.o
  CC      arch/x86/kernel/cpu/intel_cacheinfo.o
...

(using gcc (Gentoo 4.4.3-r2 p1.2) 4.4.3)

... but it should warn.

-Robert

> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Cc: Robert Richter <robert.richter@amd.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> LKML-Reference: <20101025115736.41d51abe.sfr@canb.auug.org.au>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>

-- 
Advanced Micro Devices, Inc.
Operating System Research Center


  reply	other threads:[~2010-10-25 10:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-25  0:57 linux-next: build warning in Linus' tree Stephen Rothwell
2010-10-25  6:36 ` Ingo Molnar
2010-10-25  6:52 ` [tip:perf/urgent] x86/oprofile: Fix uninitialized variable use in debug printk tip-bot for Ingo Molnar
2010-10-25 10:21   ` Robert Richter [this message]
2010-10-25 10:27     ` Ingo Molnar

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=20101025102110.GJ5969@erda.amd.com \
    --to=robert.richter@amd.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=sfr@canb.auug.org.au \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.