ioctx_alloc(): remove pointless check
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 31 Mar 2015 15:43:52 +0000 (11:43 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Apr 2015 02:27:54 +0000 (22:27 -0400)
Way, way back kiocb used to be picked from arrays, so ioctx_alloc()
checked for multiplication overflow when calculating the size of
such array.  By the time fs/aio.c went into the tree (in 2002) they
were already allocated one-by-one by kmem_cache_alloc(), so that
check had already become pointless.  Let's bury it...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/aio.c

index 3b8467aeb5eeb5ef6061dc10467f40f0d3335801..40fddf4217bde1e08bace44316acaf476f399c79 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -688,8 +688,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
        nr_events *= 2;
 
        /* Prevent overflows */
-       if ((nr_events > (0x10000000U / sizeof(struct io_event))) ||
-           (nr_events > (0x10000000U / sizeof(struct kiocb)))) {
+       if (nr_events > (0x10000000U / sizeof(struct io_event))) {
                pr_debug("ENOMEM: nr_events too high\n");
                return ERR_PTR(-EINVAL);
        }