Linux-kernel mailing list archive 2000-47,: Re: easy-to-fix bug in /dev/null driver

# Re: easy-to-fix bug in /dev/null driver

Michal Jaegermann (michal@harddata.com)
Mon, 20 Nov 2000 12:33:00 -0700

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Oliver Poths: "Kernel-2.4-Bug in raid-code ?"
- Previous message: Serguei Miridonov: "Linux driver for DC10plus/LML33/Buz video capture cards V 0.7"

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 message: Oliver Poths: "Kernel-2.4-Bug in raid-code ?"
- Previous message: Serguei Miridonov: "Linux driver for DC10plus/LML33/Buz video capture cards V 0.7"