From: Michal Jaegermann <michal@harddata.com>
To: linux-kernel@vger.kernel.org
Cc: akenning@dog.topology.org
Subject: Re: easy-to-fix bug in /dev/null driver
Date: Mon, 20 Nov 2000 12:33:00 -0700 [thread overview]
Message-ID: <20001120123300.A19251@mail.harddata.com> (raw)
In-Reply-To: <20001120160638.A14325@dog.topology.org> <20001121005304.A15760@dog.topology.org>
In-Reply-To: <20001121005304.A15760@dog.topology.org>; from Alan Kennington on Tue, Nov 21, 2000 at 12:53:04AM +1030
On Tue, Nov 21, 2000 at 12:53:04AM +1030, Alan Kennington wrote:
>
> I still think that write_null() should be rewritten as:
>
> ===================================================
> static ssize_t write_null(struct file * file, const char * buf,
> size_t count, loff_t *ppos)
> {
> return (count <= 2147483647) ? count : 2147483647;
> }
> ===================================================
>
> This would fix the problem without introducing any new errors.
> (Unless someone change the definitions of ssize_t and size_t!!)
Someone already did. Or, more precisely, there are platforms where
values used in 'return' above are bogus.
Shifting 1 up by sizeof(ssize_t) * 8 - 1 and subtracting one from
the result, in order to derive the maximal allowable value, might work.
I do not think that we have anything with non-8 bit bytes yet.
Michal
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2000-11-20 20:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-20 5:36 easy-to-fix bug in /dev/null driver Alan Kennington
2000-11-20 14:23 ` Alan Kennington
2000-11-20 19:33 ` Michal Jaegermann [this message]
2000-11-20 23:13 ` Abramo Bagnara
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=20001120123300.A19251@mail.harddata.com \
--to=michal@harddata.com \
--cc=akenning@dog.topology.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