lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <dd85c092-379e-4d14-88f0-8f3910de9f7f@p183>
Date:   Fri, 21 Apr 2023 21:54:36 +0300
From:   Alexey Dobriyan <adobriyan@...il.com>
To:     akpm@...ux-foundation.org
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH] ELF: use __builtin_mul_overflow() more

__builtin_mul_overflow() can do multiplication and overflow check
in one line.

Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---

 fs/binfmt_elf.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1651,9 +1651,8 @@ static int fill_files_note(struct memelfnote *note, struct coredump_params *cprm
 
 	/* *Estimated* file count and total data size needed */
 	count = cprm->vma_count;
-	if (count > UINT_MAX / 64)
+	if (__builtin_mul_overflow(count, 64, &size))
 		return -EINVAL;
-	size = count * 64;
 
 	names_ofs = (2 + 3 * count) * sizeof(data[0]);
  alloc:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ