From: Bruno Ducrot <poup@poupinou.org>
To: linux-kernel@vger.kernel.org
Cc: Bruno Ducrot <ducrot@poupinou.org>
Subject: [AMD64] Possible bug in fs/read_write.c::rw_verify_area
Date: Wed, 9 Nov 2005 11:37:01 +0100 [thread overview]
Message-ID: <20051109103701.GA8491@poupinou.org> (raw)
Hi all,
fs/read_write.c::rw_verify_area check if the count for a read/write is
valid. Unfortunately, this check assume that a size_t is an int, which
is wrong at least on AMD64 architecture.
This fix is not correct also in general: it is wrong to assume
that size_t is a long int. A correct fix would be to introduce
a new constant (say SSIZE_MAX) for each supported architecture
and to use that contstant instead. I'm not an expert on this and
it is why I don't do it (sorry). But at least the following patch
is ok for more achitecture, I believe.
Signed-off-by: Bruno Ducrot <ducrot@poupinou.org>
--- linux-2.6.14/fs/read_write.c 2005/11/09 10:19:04 1.1
+++ linux-2.6.14/fs/read_write.c 2005/11/09 10:19:40
@@ -188,7 +188,7 @@ int rw_verify_area(int read_write, struc
struct inode *inode;
loff_t pos;
- if (unlikely(count > INT_MAX))
+ if (unlikely(count > LONG_MAX))
goto Einval;
pos = *ppos;
if (unlikely((pos < 0) || (loff_t) (pos + count) < 0))
--
Bruno Ducrot
-- Which is worse: ignorance or apathy?
-- Don't know. Don't care.
reply other threads:[~2005-11-09 10:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20051109103701.GA8491@poupinou.org \
--to=poup@poupinou.org \
--cc=ducrot@poupinou.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®