From: Andrew Morton <akpm@linux-foundation.org>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: "Sergey S. Kostyliov" <rathamahata@php4.ru>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] befs: redundant test on unsigned in befs_get_block()?
Date: Fri, 16 Oct 2009 14:25:18 -0700 [thread overview]
Message-ID: <20091016142518.998c41a2.akpm@linux-foundation.org> (raw)
In-Reply-To: <4AD88DE1.1080900@gmail.com>
On Fri, 16 Oct 2009 17:14:41 +0200
Roel Kluin <roel.kluin@gmail.com> wrote:
> block is unsigned, this test appears redundant.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Or is a different test required?
>
> diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
> index 33baf27..3ab1336 100644
> --- a/fs/befs/linuxvfs.c
> +++ b/fs/befs/linuxvfs.c
> @@ -128,13 +128,6 @@ befs_get_block(struct inode *inode, sector_t block,
> befs_debug(sb, "---> befs_get_block() for inode %lu, block %ld",
> inode->i_ino, block);
>
> - if (block < 0) {
> - befs_error(sb, "befs_get_block() was asked for a block "
> - "number less than zero: block %ld in inode %lu",
> - block, inode->i_ino);
> - return -EIO;
> - }
> -
> if (create) {
> befs_error(sb, "befs_get_block() was asked to write to "
> "block %ld in inode %lu", block, inode->i_ino);
As far as the VFS is concerned, `block' is indeed unsigned and may well
be in the range 2G-4G with a 32-bit sector_t. Perhaps not possible on
befs but still legal to the VFS.
So the test is wrong from that POV.
However it is possible that befs is defending itself here. Perhaps code
internal to befs will explode if passed a "negative" block number. Due
to coding errors within the fs implementation.
So really, we'd need to check all code paths called by
befs_get_block() and check that they are signednessly clean.
next prev parent reply other threads:[~2009-10-16 21:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-16 15:14 [PATCH] befs: redundant test on unsigned in befs_get_block()? Roel Kluin
2009-10-16 21:25 ` Andrew Morton [this message]
2009-10-20 21:17 ` Roel Kluin
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=20091016142518.998c41a2.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rathamahata@php4.ru \
--cc=roel.kluin@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox