[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 05/29] device/blkio.c (block_io): check if io_count is larger
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 05/29] device/blkio.c (block_io): check if io_count is larger or equal to zero |
Date: |
Tue, 10 Dec 2013 08:04:53 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Marin Ramesa, le Tue 10 Dec 2013 01:25:58 +0100, a écrit :
> On 10.12.2013 00:48:26, Samuel Thibault wrote:
> > Marin Ramesa, le Mon 09 Dec 2013 23:57:20 +0100, a écrit :
> > > Check if member io_count is non-negative.
> >
> > Can it really be negative? I don't see existing functions test for
> > that, so maybe it should be an unsigned long actually, and it's
> > creators of ior structures which should make sure they don't stuff
> > negative values there.
>
> Yes, maybe it should be an unsigned long. It's used as an argument in
> functions take take vm_size_t and size_t argument types (at least in
> the device directory). It seems wrong to rely on outside source to be
> correct. Who knows what will be passed as an argument.
Yes, but when the source is the kernel itself, it could probably be
trusted. What I mean is that it should be checked when the kernel
copies the value from userland parameters into the io request structure.
It's better to return the error as early as this, rather than letting
the check happen (or not...) within drivers.
Samuel
- [PATCH 01/29] i386: move prototypes to fix implicit declaration of function, Marin Ramesa, 2013/12/09
- [PATCH 03/29] i386/i386/db_interface.c: use vm_offset_t instead of an unsigned int, Marin Ramesa, 2013/12/09
- [PATCH 06/29] device/chario.c (char_write): check if io_count is larger or equal to zero and cast it to vm_size_t, Marin Ramesa, 2013/12/09
- [PATCH 07/29] device/chario.c (char_read): check if io_count is larger or equal to zero, Marin Ramesa, 2013/12/09
- [PATCH 08/29] device/chario.c: trivial stylistic fix for consistency, Marin Ramesa, 2013/12/09
- [PATCH 09/29] device/cirbuf.c (getc): use char instead of an unsigned char, Marin Ramesa, 2013/12/09
- [PATCH 10/29] device/cirbuf.c (cb_alloc): use vm_size_t instead of an int, Marin Ramesa, 2013/12/09
- [PATCH 11/29] device/cirbuf.c (cb_free): use vm_size_t instead of an int, Marin Ramesa, 2013/12/09
- [PATCH 12/29] device/cons.c: fix argument list, Marin Ramesa, 2013/12/09