qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Riku Voipio <riku.voipio@iki.fi>, Alexander Graf <agraf@suse.de>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] linux-user: Simplify boundary checks on g_posix_timers range
Date: Fri, 22 Aug 2014 12:45:11 +0100	[thread overview]
Message-ID: <CAFEAcA80k+TYvtFJ_wYR06KVFVa=E_=UsLGjo7i6PDUSp=3E6Q@mail.gmail.com> (raw)
In-Reply-To: <53F72B21.4010105@suse.de>

On 22 August 2014 12:36, Andreas Färber <afaerber@suse.de> wrote:
> Am 22.08.2014 13:33, schrieb Peter Maydell:
>> On 22 August 2014 12:19, Alexander Graf <agraf@suse.de> 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?

The kernel seems to use 'int' for the timer id type, which suggests
that this mask is just wrong.

-- PMM

  reply	other threads:[~2014-08-22 11:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22 11:19 [Qemu-devel] [PATCH] linux-user: Simplify boundary checks on g_posix_timers range Alexander Graf
2014-08-22 11:33 ` Peter Maydell
2014-08-22 11:36   ` Andreas Färber
2014-08-22 11:45     ` Peter Maydell [this message]
2014-08-22 11:42   ` Alexander Graf
2014-08-22 11:44     ` Peter Maydell
2014-08-22 11:45       ` Alexander Graf
2014-08-22 11:49         ` Peter Maydell
2014-08-22 11:52           ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFEAcA80k+TYvtFJ_wYR06KVFVa=E_=UsLGjo7i6PDUSp=3E6Q@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).