Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751612AbbBXHfz (ORCPT ); Tue, 24 Feb 2015 02:35:55 -0500 Received: from mail-wi0-f171.google.com ([209.85.212.171]:39537 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750788AbbBXHfy (ORCPT ); Tue, 24 Feb 2015 02:35:54 -0500 Date: Tue, 24 Feb 2015 08:35:48 +0100 From: Ingo Molnar To: Heinrich Schuchardt Cc: Andrew Morton , Aaron Tomlin , Andy Lutomirski , Davidlohr Bueso , David Rientjes , "David S. Miller" , Fabian Frederick , Guenter Roeck , "H. Peter Anvin" , Jens Axboe , Joe Perches , Johannes Weiner , Kees Cook , Michael Marineau , Oleg Nesterov , "Paul E. McKenney" , Peter Zijlstra , Prarit Bhargava , Rik van Riel , Rusty Russell , Steven Rostedt , Thomas Gleixner , Vladimir Davydov , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4 v4] kernel/fork.c: avoid division by zero Message-ID: <20150224073548.GB16195@gmail.com> References: <20150222075825.GA20626@gmail.com> <1424722477-23758-1-git-send-email-xypron.glpk@gmx.de> <1424722477-23758-3-git-send-email-xypron.glpk@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1424722477-23758-3-git-send-email-xypron.glpk@gmx.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 980 Lines: 28 * Heinrich Schuchardt wrote: > PAGE_SIZE is not guaranteed to be equal to or less than 8 times the > THREAD_SIZE. > > E.g. architecture hexagon may have page size 1M and thread size 4096. > This would lead to a division by zero in the calculation of max_threads. > > With 32-bit calculus there is no solution which delivers valid results > for all possible combinations of the parameters. > The code is only called once. > Hence a 64-bit calculation can be used as solution. > > The calculation of max_threads is moved to a separate function. Please keep the 'move to a separate function' patch in a separate patch and don't mix it up with the fix, as I suggested it in my previous review. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/