All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tian, Kevin" <kevin.tian@intel.com>
To: Sergey Dyasli <sergey.dyasli@citrix.com>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>,
	"jbeulich@suse.com" <jbeulich@suse.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v2 1/3] x86/vmx: introduce vmx_find_msr()
Date: Wed, 22 Feb 2017 08:40:55 +0000	[thread overview]
Message-ID: <AADFC41AFE54684AB9EE6CBC0274A5D190C43855@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1487752669.4239.1.camel@citrix.com>

> From: Sergey Dyasli [mailto:sergey.dyasli@citrix.com]
> Sent: Wednesday, February 22, 2017 4:38 PM
> 
> > >
> > > -    for ( idx = 0; idx < *msr_count; idx++ )
> > > +    for ( idx = 0; (*msr_area)[idx].index <= msr && idx < *msr_count; idx++ )
> >
> > risk of out-of-boundary access.
> 
> How exactly out-of-bounds access is possible? The original condition
> 
>     idx < *msr_count
> 
> Is still being checked on each loop iteration.
> 

Isn't "(*msr_area[idx]).index <= msr" checked before "idx < *msr_count"?

So if idx==*msr_count, you first hit an out-of-boundary access...

I think we should change the condition order here.

Thanks
Kevin
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-02-22  8:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 15:42 [PATCH v2 0/3] x86/vmx: fix for vmentry failure with TSX bits in LBR Sergey Dyasli
2017-02-17 15:42 ` [PATCH v2 1/3] x86/vmx: introduce vmx_find_msr() Sergey Dyasli
     [not found]   ` <AADFC41AFE54684AB9EE6CBC0274A5D190C40BC0@SHSMSX101.ccr.corp.intel.com>
2017-02-22  8:37     ` Sergey Dyasli
2017-02-22  8:40       ` Tian, Kevin [this message]
2017-02-22  8:45         ` Sergey Dyasli
2017-02-22 10:14           ` Jan Beulich
2017-02-17 15:42 ` [PATCH v2 2/3] x86/vmx: optimize vmx_read/write_guest_msr() Sergey Dyasli
2017-02-21  9:31   ` Tian, Kevin
2017-02-22 10:16   ` Jan Beulich
2017-02-17 15:42 ` [PATCH v2 3/3] x86/vmx: fix vmentry failure with TSX bits in LBR Sergey Dyasli
2017-02-21  9:13   ` Tian, Kevin
2017-02-21 11:25     ` Andrew Cooper
2017-02-22  2:56       ` Tian, Kevin
2017-02-22 10:26   ` Jan Beulich
2017-02-22 13:58     ` Sergey Dyasli
2017-02-22 14:04       ` Andrew Cooper
2017-02-22 14:13       ` Jan Beulich

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=AADFC41AFE54684AB9EE6CBC0274A5D190C43855@SHSMSX101.ccr.corp.intel.com \
    --to=kevin.tian@intel.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=sergey.dyasli@citrix.com \
    --cc=xen-devel@lists.xen.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 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.