qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Frediano Ziglio <fziglio@redhat.com>
Cc: qemu-trivial@nongnu.org, Michael Tokarev <mjt@tls.msk.ru>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Check value for invalid negative values
Date: Thu, 18 Jun 2015 15:56:39 +0200	[thread overview]
Message-ID: <1434635799.4968.33.camel@redhat.com> (raw)
In-Reply-To: <789608027.17460503.1434624352586.JavaMail.zimbra@redhat.com>

On Do, 2015-06-18 at 06:45 -0400, Frediano Ziglio wrote:
>  > On Do, 2015-06-18 at 05:58 -0400, Frediano Ziglio wrote:
> > > For the same reason there is the v >= l test.
> > > The v >= l test state that the value can be out of range so it not always a
> > > constant in the range.
> > > Adding the v < 0 check for every invalid value. As these are executed only
> > > for logging should not be a performance penalty.
> > > I also hope the compiler is able to optimize
> > > 
> > > if (v < 0 || v >= l)
> > > 
> > > with
> > > 
> > > if ((unsigned) v >= l)
> > 
> > Just make v explicitly unsigned?
> > 
> > cheers,
> >   Gerd
> > 
> 
> Do you mean in the prototype?

Yes.

> Well, this could have side effect due to different conversions so is not a so trivial patch.

What side effects?  I don't expect any for in-range values, and how
exactly we catch out-of-range values doesn't really matter ...

cheers,
  Gerd

  reply	other threads:[~2015-06-18 13:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 13:17 [Qemu-devel] [PATCH 1/2] Constify some variable Frediano Ziglio
2015-06-11 13:17 ` [Qemu-devel] [PATCH 2/2] Check value for invalid negative values Frediano Ziglio
2015-06-17 19:27   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2015-06-18  9:58     ` Frediano Ziglio
2015-06-18 10:18       ` Gerd Hoffmann
2015-06-18 10:45         ` Frediano Ziglio
2015-06-18 13:56           ` Gerd Hoffmann [this message]
2015-06-17 19:23 ` [Qemu-devel] [PATCH 1/2] Constify some variable Michael Tokarev

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=1434635799.4968.33.camel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=fziglio@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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).