bug-hurd
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]