--- fs/file.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/fs/file.c b/fs/file.c index 4579c3296498..b6fb6d18ac3b 100644 --- a/fs/file.c +++ b/fs/file.c @@ -126,21 +126,6 @@ static struct fdtable * alloc_fdtable(unsigned int nr) if (unlikely(nr > sysctl_nr_open)) nr = ((sysctl_nr_open - 1) | (BITS_PER_LONG - 1)) + 1; - /* - * Check if the allocation size would exceed INT_MAX. kvmalloc_array() - * and kvmalloc() will warn if the allocation size is greater than - * INT_MAX, as filp_cachep objects are not __GFP_NOWARN. - * - * This can happen when sysctl_nr_open is set to a very high value and - * a process tries to use a file descriptor near that limit. For example, - * if sysctl_nr_open is set to 1073741816 (0x3ffffff8) - which is what - * systemd typically sets it to - then trying to use a file descriptor - * close to that value will require allocating a file descriptor table - * that exceeds 8GB in size. - */ - if (unlikely(nr > INT_MAX / sizeof(struct file *))) - return ERR_PTR(-EMFILE); - fdt = kmalloc(sizeof(struct fdtable), GFP_KERNEL_ACCOUNT); if (!fdt) goto out;