public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH] bio: gcc warning fix.
@ 2006-01-06 15:48 Khushil Dep
  2006-01-06 18:41 ` Jesper Juhl
  0 siblings, 1 reply; 16+ messages in thread
From: Khushil Dep @ 2006-01-06 15:48 UTC (permalink / raw)
  To: Al Viro, Luiz Fernando Capitulino; +Cc: akpm, axboe, lkml

I wonder however whether this is not correct? I was always taught to
initialise variables so there is no doubt as to their starting value?

-----------------------
Khushil Dep

-----Original Message-----
From: linux-kernel-owner@vger.kernel.org
[mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Al Viro
Sent: 06 January 2006 15:40
To: Luiz Fernando Capitulino
Cc: akpm; axboe@suse.de; lkml
Subject: Re: [PATCH] bio: gcc warning fix.

On Fri, Jan 06, 2006 at 01:07:29PM -0200, Luiz Fernando Capitulino
wrote:
> 
>  Fixes the following gcc 4.0.2 warning:
> 
> fs/bio.c: In function 'bio_alloc_bioset':
> fs/bio.c:167: warning: 'idx' may be used uninitialized in this
function

NAK.  There is nothing to fix except for broken logics in gcc.
Please, do not obfuscate correct code just to make gcc to shut up.
Especially for this call of warnings; gcc4 *blows* in that area.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 16+ messages in thread
* [PATCH] bio: gcc warning fix.
@ 2006-01-06 15:07 Luiz Fernando Capitulino
  2006-01-06 15:28 ` Jens Axboe
  2006-01-06 15:39 ` Al Viro
  0 siblings, 2 replies; 16+ messages in thread
From: Luiz Fernando Capitulino @ 2006-01-06 15:07 UTC (permalink / raw)
  To: akpm; +Cc: axboe, lkml


 Fixes the following gcc 4.0.2 warning:

fs/bio.c: In function 'bio_alloc_bioset':
fs/bio.c:167: warning: 'idx' may be used uninitialized in this function

Signed-off-by: Luiz Capitulino <lcapitulino@mandriva.com.br>

 fs/bio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/bio.c b/fs/bio.c
index 38d3e80..55a5688 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -164,7 +164,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_m
 
 		bio_init(bio);
 		if (likely(nr_iovecs)) {
-			unsigned long idx;
+			unsigned long idx = 0;
 
 			bvl = bvec_alloc_bs(gfp_mask, nr_iovecs, &idx, bs);
 			if (unlikely(!bvl)) {


-- 
Luiz Fernando N. Capitulino

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2006-01-07 12:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-06 15:48 [PATCH] bio: gcc warning fix Khushil Dep
2006-01-06 18:41 ` Jesper Juhl
2006-01-06 18:48   ` Jens Axboe
2006-01-06 18:53     ` Jesper Juhl
2006-01-06 18:58     ` Luiz Fernando Capitulino
2006-01-06 19:04       ` Jens Axboe
2006-01-06 19:05       ` Jesper Juhl
2006-01-06 19:33     ` Zan Lynx
2006-01-06 19:56       ` Al Viro
2006-01-07 12:22         ` Peter Osterlund
  -- strict thread matches above, loose matches on Subject: below --
2006-01-06 15:07 Luiz Fernando Capitulino
2006-01-06 15:28 ` Jens Axboe
2006-01-06 15:39 ` Al Viro
2006-01-06 22:43   ` Daniel Barkalow
2006-01-06 22:52     ` Jesper Juhl
2006-01-06 23:13       ` Daniel Barkalow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox