From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKnEW-0008V4-Le for qemu-devel@nongnu.org; Fri, 22 Aug 2014 07:42:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKnEO-0001rx-QB for qemu-devel@nongnu.org; Fri, 22 Aug 2014 07:42:16 -0400 Received: from cantor2.suse.de ([195.135.220.15]:38315 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKnEO-0001rt-Je for qemu-devel@nongnu.org; Fri, 22 Aug 2014 07:42:08 -0400 Message-ID: <53F72C90.3050000@suse.de> Date: Fri, 22 Aug 2014 13:42:08 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1408706366-43407-1-git-send-email-agraf@suse.de> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] linux-user: Simplify boundary checks on g_posix_timers range List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Riku Voipio , QEMU Developers , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= On 22.08.14 13:33, Peter Maydell wrote: > On 22 August 2014 12:19, Alexander Graf wrote: >> We check whether the passed in counter value is negative on all calls >> that involve g_posix_timers. However, we AND the value down to 16 bits >> right before the check, so they can never be negative. > > ...but why exactly are we doing that AND with 0xffff ?? It seems > unlikely that the kernel really allows random garbage in the top > half of the timer ID arguments, so maybe we should drop the > mask and keep the <0 bounds checks? Or we drop the AND and and the <0 check and treat arg1 as unsigned ;). Alex