From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Eric Sesterhenn / Snakebyte <snakebyte-Mmb7MZpHnFY@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: Bug in drivers/kvm/vmx.c inject_rmode_irq()?
Date: Tue, 10 Apr 2007 15:25:15 +0300 [thread overview]
Message-ID: <461B822B.2020402@qumranet.com> (raw)
In-Reply-To: <20070409141505.GG29936@alice>
Eric Sesterhenn / Snakebyte wrote:
> * Avi Kivity (avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org) wrote:
>
>> Eric Sesterhenn / Snakebyte wrote:
>>
>>> i was testing the gcc 4.3 against the latest git kernel, and got a
>>> warning in your code (using -Wstrict-overflow=1)
>>>
>>> drivers/kvm/vmx.c: In function 'inject_rmode_irq':
>>> drivers/kvm/vmx.c:1193: warning: assuming signed overflow does not occur
>>> when assuming that (X - c) > X is always false
>>>
>>> The problem is basically that gcc 4.3 handles integer overflows
>>> different, when using -O2 and -Os, the code triggering this is the
>>> following:
>>>
>>> if (sp > ss_limit || sp - 6 > sp) {
>>>
>>> I am not completely sure, but wouldnt a check for
>>> ( sp > ss_limit || sp > 6 ) be enough?
>>>
>>>
>> hmm. sp is declared as u16, which is unsigned. I don't see how gcc can
>> promote it to a signed type, unless I'm misremembering C's promotion rules.
>>
>> Anyway, it could just be coded as
>>
>> if (sp > ss_limit || sp < 6)
>>
>> and achieve the same effect.
>>
>>
>
> Since 4.2 gcc might decide that overflows can never occur, and optimize
> away this check, see http://gcc.gnu.org/gcc-4.2/changes.html
> Lets make sure we still check this.
>
> Signed-off-by: Eric Sesterhenn <snakebyte-Mmb7MZpHnFY@public.gmane.org>
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
prev parent reply other threads:[~2007-04-10 12:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070409112625.GB29936@alice>
[not found] ` <461A439D.5020102@qumranet.com>
[not found] ` <461A439D.5020102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-09 14:15 ` Bug in drivers/kvm/vmx.c inject_rmode_irq()? Eric Sesterhenn / Snakebyte
2007-04-10 12:25 ` Avi Kivity [this message]
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=461B822B.2020402@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=snakebyte-Mmb7MZpHnFY@public.gmane.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