All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Satyam Sharma <satyam@infradead.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	James Bottomley <james.bottomley@steeleye.com>,
	Oliver Neukum <oliver@neukum.name>,
	linux-scsi@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH -mm] DC395x SCSI driver: Shut up uninitialized variable build warning
Date: Sun, 02 Sep 2007 16:23:59 -0400	[thread overview]
Message-ID: <46DB1BDF.4090100@garzik.org> (raw)
In-Reply-To: <alpine.LFD.0.999.0709030152260.29617@enigma.security.iitk.ac.in>

Satyam Sharma wrote:
> drivers/scsi/dc395x.c: In function ‘dc395x_init_one’:
> drivers/scsi/dc395x.c:4272: warning: ‘ptr’ may be used uninitialized in this function
> 
> has been verified to be a bogus warning. Let's shut it up.
> 
> Signed-off-by: Satyam Sharma <satyam@infradead.org>
> 
> ---
> 
>  drivers/scsi/dc395x.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- linux-2.6.23-rc4-mm1/drivers/scsi/dc395x.c~fix	2007-09-02 20:57:51.000000000 +0530
> +++ linux-2.6.23-rc4-mm1/drivers/scsi/dc395x.c	2007-09-02 21:10:49.000000000 +0530
> @@ -4269,7 +4269,7 @@ static int __devinit adapter_sg_tables_a
>  	const unsigned srbs_per_page = PAGE_SIZE/SEGMENTX_LEN;
>  	int srb_idx = 0;
>  	unsigned i = 0;
> -	struct SGentry *ptr;
> +	struct SGentry * uninitialized_var(ptr);

For things like this, we need to see (perhaps a separate email in the 
same thread) your build details:  config, arch, compiler version, etc.

This warning does not appear on x86 or x86-64 here, with the current 
version of gcc.  And I'm not so sure we want to be adding these markers 
for older versions of the compiler, or for what is ultimately a 
temporary [situation | configuration] in the grand scheme of things.

I paid careful attention to my recent set of uninitialized_var() markers 
(now upstream), making sure that they persisted across several compiler 
versions, ensuring the warning was not a temporary optimizer bug quickly 
remedied.

I hope to encourage similar diligence in others :)  These markers have 
the very-real potential downside of hiding bugs, so they should be used 
sparingly.

	Jeff


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Jeff Garzik <jeff@garzik.org>
To: Satyam Sharma <satyam@infradead.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	James Bottomley <james.bottomley@steeleye.com>,
	Oliver Neukum <oliver@neukum.name>,
	linux-scsi@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH -mm] DC395x SCSI driver: Shut up uninitialized variable build warning
Date: Sun, 02 Sep 2007 16:23:59 -0400	[thread overview]
Message-ID: <46DB1BDF.4090100@garzik.org> (raw)
In-Reply-To: <alpine.LFD.0.999.0709030152260.29617@enigma.security.iitk.ac.in>

Satyam Sharma wrote:
> drivers/scsi/dc395x.c: In function ‘dc395x_init_one’:
> drivers/scsi/dc395x.c:4272: warning: ‘ptr’ may be used uninitialized in this function
> 
> has been verified to be a bogus warning. Let's shut it up.
> 
> Signed-off-by: Satyam Sharma <satyam@infradead.org>
> 
> ---
> 
>  drivers/scsi/dc395x.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- linux-2.6.23-rc4-mm1/drivers/scsi/dc395x.c~fix	2007-09-02 20:57:51.000000000 +0530
> +++ linux-2.6.23-rc4-mm1/drivers/scsi/dc395x.c	2007-09-02 21:10:49.000000000 +0530
> @@ -4269,7 +4269,7 @@ static int __devinit adapter_sg_tables_a
>  	const unsigned srbs_per_page = PAGE_SIZE/SEGMENTX_LEN;
>  	int srb_idx = 0;
>  	unsigned i = 0;
> -	struct SGentry *ptr;
> +	struct SGentry * uninitialized_var(ptr);

For things like this, we need to see (perhaps a separate email in the 
same thread) your build details:  config, arch, compiler version, etc.

This warning does not appear on x86 or x86-64 here, with the current 
version of gcc.  And I'm not so sure we want to be adding these markers 
for older versions of the compiler, or for what is ultimately a 
temporary [situation | configuration] in the grand scheme of things.

I paid careful attention to my recent set of uninitialized_var() markers 
(now upstream), making sure that they persisted across several compiler 
versions, ensuring the warning was not a temporary optimizer bug quickly 
remedied.

I hope to encourage similar diligence in others :)  These markers have 
the very-real potential downside of hiding bugs, so they should be used 
sparingly.

	Jeff



  reply	other threads:[~2007-09-02 20:24 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LFD.0.999.0709022344550.27844@enigma.security.iitk.ac.i n>
2007-09-02 20:02 ` [-mm patchset] War on warnings Satyam Sharma
2007-09-02 20:04   ` Jesper Juhl
2007-09-02 20:39     ` Satyam Sharma
2007-09-02 20:30       ` Jesper Juhl
2007-09-02 20:07   ` [PATCH -mm] sisusbvga: Fix bug and build warnings Satyam Sharma
2007-09-02 20:11     ` Jesper Juhl
2007-09-02 20:32       ` Satyam Sharma
2007-09-02 20:23         ` Jesper Juhl
2007-09-02 21:18           ` Alistair John Strachan
2007-09-02 21:38             ` Satyam Sharma
2007-09-02 22:27               ` Satyam Sharma
2007-09-09 21:32     ` patch usb-sisusbvga-fix-bug-and-build-warnings.patch added to gregkh-2.6 tree gregkh
2007-09-02 20:09   ` [PATCH -mm] sunrpc svc: Shut up bogus uninitialized variable warning Satyam Sharma
2007-09-02 20:11   ` [PATCH -mm] net/wireless/sysfs.c: Shut up build warning Satyam Sharma
2007-09-02 20:24     ` Johannes Berg
2007-09-02 20:12   ` [PATCH -mm] drivers/usb/serial/bus.c: Fix incompatible pointer type warning Satyam Sharma
2007-09-02 20:13   ` [PATCH -mm] IPS SCSI driver: Check return of scsi_add_host() Satyam Sharma
2007-09-02 20:03     ` Jesper Juhl
2007-09-02 20:03       ` Jesper Juhl
2007-09-02 20:32     ` Jeff Garzik
2007-09-02 20:32       ` Jeff Garzik
2007-09-02 22:39       ` Satyam Sharma
2007-09-02 20:15   ` [PATCH -mm] sb16: Shut up uninitialized var build warning Satyam Sharma
2007-09-02 22:06     ` Rene Herman
2007-09-02 22:06       ` Rene Herman
2007-09-02 22:34       ` Satyam Sharma
2007-09-02 22:34         ` Satyam Sharma
2007-09-20 17:52       ` Denys Vlasenko
2007-09-20 17:52         ` Denys Vlasenko
2007-09-22  4:20         ` Rene Herman
2007-09-22  4:20           ` Rene Herman
2007-09-02 20:16   ` [PATCH -mm] drivers/mmc/core/bus.c: Fix unused var warning Satyam Sharma
2007-09-03  9:04     ` Pierre Ossman
2007-09-02 20:18   ` [PATCH -mm] I2O: Fix "defined but not used" build warnings Satyam Sharma
2007-09-02 20:20   ` [PATCH -mm] mpt fusion: Shut up uninitialized variable warnings Satyam Sharma
2007-09-05 23:55     ` Moore, Eric
2007-09-02 20:21   ` [PATCH -mm] es18xx: Shut up uninitialized var build warning Satyam Sharma
2007-09-02 22:14     ` Rene Herman
2007-09-02 22:14       ` Rene Herman
2007-09-02 20:22   ` [PATCH -mm] drivers/md/: Shut up uninitialized variable warnings Satyam Sharma
2007-09-02 20:22     ` Satyam Sharma
2007-09-02 20:34     ` Jeff Garzik
2007-09-02 20:57       ` Satyam Sharma
2007-09-02 20:57         ` Satyam Sharma
2007-09-02 20:23   ` [PATCH -mm] DC395x SCSI driver: Shut up uninitialized variable build warning Satyam Sharma
2007-09-02 20:23     ` Jeff Garzik [this message]
2007-09-02 20:23       ` Jeff Garzik
2007-09-02 20:49       ` Satyam Sharma
2007-09-02 20:43         ` Jeff Garzik
2007-09-02 20:24   ` [PATCH -mm] i386 cpuid_count: Fix argument signedness warnings Satyam Sharma

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=46DB1BDF.4090100@garzik.org \
    --to=jeff@garzik.org \
    --cc=akpm@linux-foundation.org \
    --cc=james.bottomley@steeleye.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oliver@neukum.name \
    --cc=satyam@infradead.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.