lkml.org 
[lkml]   [2005]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateSat, 29 Oct 2005 07:59:54 +0200
FromRichard Knutsson <>
SubjectRe: 2.6.14 assorted warnings
Jens Axboe wrote:

>On Fri, Oct 28 2005, Arnd Bergmann wrote:
>
>
>>In the example, bvec_alloc_bs does not initialize &idx when nr is not
>>between 1 and BIO_MAX_PAGES, so gcc is telling the truth here.
>>
>>
>
>Wrong. idx is always initialized if being used.
>
>
>
Is the compiler really that smart as it searches back into the parent-function and try all the combinations? Otherwise, Arnd is correct.
And on an philosophical plane, can/should we put that responsibility onto the compiler? Is it not "easier" to make the functions take care
of its own duties (like the *nix-way) and make the bvec_alloc_bs initialize idx (even if it has to be an error-value)?

I'm thinking something like this. Seems alright?

/Richard

---
diff -Nurp a/fs/bio.c b/fs/bio.c
--- a/fs/bio.c 2005-10-29 06:30:49.000000000 +0200
+++ b/fs/bio.c 2005-10-29 06:33:00.000000000 +0200
@@ -90,6 +90,7 @@ static inline struct bio_vec *bvec_alloc
case 65 ... 128: *idx = 4; break;
case 129 ... BIO_MAX_PAGES: *idx = 5; break;
default:
+ *idx = -1;
return NULL;
}
/*

-
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/

\
 
 \ /
  Last update: 2005-10-29 07:58    [from the cache]
©2003-2010