[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] linux-user: Simplify boundary checks on g_posix
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH] linux-user: Simplify boundary checks on g_posix_timers range |
Date: |
Fri, 22 Aug 2014 13:36:01 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 |
Am 22.08.2014 13:33, schrieb Peter Maydell:
> On 22 August 2014 12:19, Alexander Graf <address@hidden> 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 maybe just use a local int16_t variable? I.e., should 0xffff match
the <0 check there or not?
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg