Re: [PATCH] aio: remove redundant check in ioctx_alloc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chengguang Xu <cgxu519@xxxxxxx> writes:

> We don't have to check if nr_events is zero in
> ioctx_alloc() because the caller has already
> done that.

No, this is not a redundant check.  We did some math on that value and
we have to make sure it didn't overflow.

Cheers,
Jeff

>
> Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx>
> ---
>  fs/aio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index b906ff70c90f..7b26c4feb0de 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -720,7 +720,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
>  		return ERR_PTR(-EINVAL);
>  	}
>  
> -	if (!nr_events || (unsigned long)max_reqs > aio_max_nr)
> +	if ((unsigned long)max_reqs > aio_max_nr)
>  		return ERR_PTR(-EAGAIN);
>  
>  	ctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL);



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux