qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] linux-user: Simplify timerid checks on g_pos


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: Simplify timerid checks on g_posix_timers range
Date: Fri, 22 Aug 2014 14:12:35 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.0


On 22.08.14 14:07, Peter Maydell wrote:
> On 22 August 2014 12:56, Alexander Graf <address@hidden> wrote:
>> We check whether the passed in timer id is negative on all calls
>> that involve g_posix_timers.
>>
>> However, these checks are bogus. First off we limit the timer_id to
>> 16 bits which is not what Linux does. Then we check whether it's negative
>> which it can't be because we masked it.
>>
>> We can safely remove the masking. For the negativity check we can just
>> treat the timerid as unsigned and only check for upper boundaries.
> 
> Timer IDs aren't unsigned for the kernel; why not just drop
> the mask and keep the <0 checks?

Because I'd then have to carry yet another local patch.

In Linux, the timer id is a "key" into a hash table that the kernel
searches to find its timer. In QEMU it's an offset into an array.

In both cases the syscall user receives it as a token from a create
function and should treat it as opaque.

So in the QEMU case it is unsigned, regardless of what the kernel allows
it to be, because it's an array offset.


Alex



reply via email to

[Prev in Thread] Current Thread [Next in Thread]