]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fs/binfmt_elf.c: coredump: delete duplicated overflow check
authorAlexey Dobriyan <adobriyan@gmail.com>
Fri, 31 Jan 2020 06:17:07 +0000 (22:17 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 31 Jan 2020 18:30:41 +0000 (10:30 -0800)
array_size() macro will do overflow check anyway.

Link: http://lkml.kernel.org/r/20191222144009.GB24341@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/binfmt_elf.c

index 6bf11c1d3b0fc2b99bbc4a018939e9b759e2ae59..abd10707826a376c42752380539492076f67a760 100644 (file)
@@ -2257,8 +2257,6 @@ static int elf_core_dump(struct coredump_params *cprm)
 
        dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);
 
-       if (segs - 1 > ULONG_MAX / sizeof(*vma_filesz))
-               goto end_coredump;
        vma_filesz = kvmalloc(array_size(sizeof(*vma_filesz), (segs - 1)),
                              GFP_KERNEL);
        if (ZERO_OR_NULL_PTR(vma_filesz))