From: Richard Knutsson <ricknu-0@student.ltu.se>
To: Jens Axboe <axboe@suse.de>
Cc: arnd@arndb.de, davej@redhat.com, kaos@ocs.com.au,
linux-kernel@vger.kernel.org
Subject: Re: 2.6.14 assorted warnings
Date: Sat, 29 Oct 2005 07:59:54 +0200 [thread overview]
Message-ID: <43630FDA.7010101@student.ltu.se> (raw)
In-Reply-To: <20051028082944.GI11441@suse.de>
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;
}
/*
next prev parent reply other threads:[~2005-10-29 5:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-28 7:21 2.6.14 assorted warnings Keith Owens
2005-10-28 7:28 ` Jens Axboe
2005-10-28 7:30 ` Dave Jones
2005-10-28 8:07 ` Arnd Bergmann
2005-10-28 8:29 ` Jens Axboe
2005-10-29 5:59 ` Richard Knutsson [this message]
2005-10-29 6:03 ` Al Viro
2005-10-28 8:10 ` Richard Knutsson
2005-10-30 22:15 ` Alan Cox
2005-10-30 22:25 ` Al Viro
2005-10-30 22:32 ` Al Viro
2005-10-30 22:29 ` Stephen Rothwell
2005-10-31 0:53 ` Paul Mackerras
2005-10-31 0:57 ` Al Viro
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=43630FDA.7010101@student.ltu.se \
--to=ricknu-0@student.ltu.se \
--cc=arnd@arndb.de \
--cc=axboe@suse.de \
--cc=davej@redhat.com \
--cc=kaos@ocs.com.au \
--cc=linux-kernel@vger.kernel.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.