Received: from eggs.gnu.org ([2001:4830:134:3::10]:48416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJIUi-0000ND-Dt for qemu-devel@nongnu.org; Wed, 13 Jan 2016 05:17:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJIUd-0005aT-Eq for qemu-devel@nongnu.org; Wed, 13 Jan 2016 05:17:36 -0500 From: Alberto Garcia In-Reply-To: <1452646350-11999-2-git-send-email-famz@redhat.com> References: <1452646350-11999-1-git-send-email-famz@redhat.com> <1452646350-11999-2-git-send-email-famz@redhat.com> Date: Wed, 13 Jan 2016 11:17:23 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH v2 1/2] blockdev: Error out on negative throttling option values List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Markus Armbruster , qemu-block@nongnu.org On Wed 13 Jan 2016 01:52:29 AM CET, Fam Zheng wrote: > The implicit casting from unsigned int to double changes negative values > into large positive numbers and accepts them. We should instead print > an error. > > Check the number range so this case is catched and reported. I still don't know why qemu_opt_get_number() convert silently negative numbers into positive ones, shouldn't it just fail with an "invalid parameter" error? > +#define THROTTLE_VALUE_MAX 1000000000000000L This is larger than LONG_MAX in 32-bit systems, I don't know if you need to use LL instead. Berto