Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755893AbYLJKR5 (ORCPT ); Wed, 10 Dec 2008 05:17:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754756AbYLJKRt (ORCPT ); Wed, 10 Dec 2008 05:17:49 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:38287 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754752AbYLJKRt (ORCPT ); Wed, 10 Dec 2008 05:17:49 -0500 Date: Wed, 10 Dec 2008 10:17:45 +0000 From: Al Viro To: Yuri Tikhonov Cc: Geert Uytterhoeven , linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org, Detlev Zundel , Wolfgang Denk , Milton Miller , Ilya Yanok Subject: Re: [PATCH] fork_init: fix division by zero Message-ID: <20081210101745.GG28946@ZenIV.linux.org.uk> References: <200812092044.40649.yur@emcraft.com> <503391615.20081210130113@emcraft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <503391615.20081210130113@emcraft.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 855 Lines: 21 On Wed, Dec 10, 2008 at 01:01:13PM +0300, Yuri Tikhonov wrote: > >> + max_threads = mempages * PAGE_SIZE / (8 * THREAD_SIZE); > > ^^^^^^^^^^^^^^^^^^^^ > >> +#endif > > > Can't this overflow, e.g. on 32-bit machines with HIGHMEM? > > The multiplier here is not PAGE_SIZE, but [PAGE_SIZE / (8 * > THREAD_SIZE)], and this value is expected to be rather small (2, 4, or > so). x * y / z is parsed as (x * y) / z, not x * (y / z). Only assignment operators (and ?:, in a sense that a ? b : c ? d : e is parsed as a ? b : (c ? d : e)) are right-to-left. The rest is left-to-right. -- 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/