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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Feb 2015 10:56:36 +0300
From:	Vladimir Davydov <vdavydov@...allels.com>
To:	Heinrich Schuchardt <xypron.glpk@....de>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Oleg Nesterov <oleg@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	David Rientjes <rientjes@...gle.com>,
	Kees Cook <keescook@...omium.org>,
	Aaron Tomlin <atomlin@...hat.com>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] kernel/fork.c: avoid division by zero

On Mon, Feb 16, 2015 at 07:00:44PM +0100, Heinrich Schuchardt wrote:
> diff --git a/kernel/fork.c b/kernel/fork.c
> index cf65139..71e2583 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -273,7 +273,8 @@ void __init fork_init(unsigned long mempages)
>  	 * value: the thread structures can take up at most half
>  	 * of memory.
>  	 */
> -	max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE);
> +	max_threads = (u64) PAGE_SIZE * (u64) mempages
> +		    / (u64) THREAD_SIZE / 8UL;

This won't compile for a 32 bit arch, will it? Should you use div_u64?

Thanks,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists