All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] Fix gcc4 warning,
@ 2005-05-20 18:53 Jesse Millan
  2005-05-20 19:41 ` Alexey Dobriyan
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Jesse Millan @ 2005-05-20 18:53 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 533 bytes --]


This patch eliminates the warning that is generated when passing an
uninitialized variable to a function, and in that function it 'looks'
like you may read the contents.

In this case, the address of a local variable 'idx' is passed to the
function bvec_alloc_bs(). Inside bvec_alloc_bs(), it is possible that
no value will be assigned to idx, in which case the function immediately
returns null and does not go on to read it. Human eyes can see that its
safe. Initializing it doen not hurt and it gets rid of the compiler warning.

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 423 bytes --]

Signed-off-by: Jesse Millan <jessem@cs.pdx.edu>

--- linux-2.6.12-rc4/fs/bio.c~	2005-05-20 11:24:39.163613256 -0700
+++ linux-2.6.12-rc4/fs/bio.c	2005-05-20 11:25:35.242185201 -0700
@@ -159,7 +159,7 @@ struct bio *bio_alloc_bioset(unsigned in

 		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)) {

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2005-05-26 21:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-20 18:53 [KJ] [PATCH] Fix gcc4 warning, Jesse Millan
2005-05-20 19:41 ` Alexey Dobriyan
2005-05-22  9:25 ` Arnd Bergmann
2005-05-23  1:05 ` Arnd Bergmann
2005-05-24  4:52 ` Jesse Millan
2005-05-24  4:56 ` Jesse Millan
2005-05-25  6:09 ` Jesse Millan
2005-05-25 22:41 ` Jesse Millan
2005-05-26 21:07 ` Arnd Bergmann

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.