From: Avi Kivity <avi@redhat.com>
To: Jeff Mahoney <jeffm@suse.com>
Cc: kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>,
Neil Brown <neilb@suse.de>
Subject: Re: [PATCH] kvm: Fix off by one in kvm_for_each_vcpu iteration
Date: Sun, 17 Apr 2011 12:11:44 +0300 [thread overview]
Message-ID: <4DAAAED0.6090905@redhat.com> (raw)
In-Reply-To: <4DA4FCA9.9070508@suse.com>
On 04/13/2011 04:30 AM, Jeff Mahoney wrote:
> This patch avoids gcc issuing the following warning when KVM_MAX_VCPUS=1:
> warning: array subscript is above array bounds
>
> kvm_for_each_vcpu currently checks to see if the index for the vcpu is
> valid /after/ loading it. We don't run into problems because the address
> is still inside the enclosing struct kvm and we never deference or write
> to it, so this isn't a security issue.
>
> The warning occurs when KVM_MAX_VCPUS=1 because the increment portion of
> the loop will *always* cause the loop to load an invalid location since
> ++idx will always be> 0.
>
> This patch moves the load so that the check occurs before the load and
> we don't run into the compiler warning.
Applied, thanks.
--
error compiling committee.c: too many arguments to function
prev parent reply other threads:[~2011-04-17 9:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-13 1:30 [PATCH] kvm: Fix off by one in kvm_for_each_vcpu iteration Jeff Mahoney
2011-04-17 9:11 ` 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=4DAAAED0.6090905@redhat.com \
--to=avi@redhat.com \
--cc=jeffm@suse.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=neilb@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.