Received: from eggs.gnu.org ([2001:4830:134:3::10]:40448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsnIu-00042x-52 for qemu-devel@nongnu.org; Fri, 06 Jun 2014 02:07:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsnIl-0001Tz-4x for qemu-devel@nongnu.org; Fri, 06 Jun 2014 02:07:04 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:201:233:1::3]:56166) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsnIk-0001Tf-UV for qemu-devel@nongnu.org; Fri, 06 Jun 2014 02:06:55 -0400 From: Markus Armbruster References: <20140605221842.GI15000@otherpad.lan.raisama.net> Date: Fri, 06 Jun 2014 08:06:52 +0200 In-Reply-To: <20140605221842.GI15000@otherpad.lan.raisama.net> (Eduardo Habkost's message of "Thu, 5 Jun 2014 19:18:42 -0300") Message-ID: <87egz2r2pv.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] vl.c: Check -smp option ranges before setting int globals List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Peter Maydell , Marcelo Tosatti , qemu-devel@nongnu.org, Anthony Liguori , Igor Mammedov , Andreas =?utf-8?Q?F=C3=A4rber?= Eduardo Habkost writes: > When parsing the -smp option, check if the values (that can be anywhere > in the [0, UINT64_MAX] range) are in the int range before setting the > int globals smp_cpus, max_cpus, smp_cores, smp_threads. > > Without this, it was posbible to make smp_cpus and max_cpus negative. > > Signed-off-by: Eduardo Habkost The INT_MAX limit might be too generous, but your code sure beats the silent truncation we have now. Reviewed-by: Markus Armbruster