From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] gnttab: fix out of range shift count Date: Wed, 17 Jun 2015 16:27:59 +0100 Message-ID: <558191FF.9080804@citrix.com> References: <5581ADBC020000780008647D@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z5FG5-0000lO-13 for xen-devel@lists.xenproject.org; Wed, 17 Jun 2015 15:28:09 +0000 In-Reply-To: <5581ADBC020000780008647D@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , xen-devel Cc: Ian Campbell , Keir Fraser , Ian Jackson , Tim Deegan List-Id: xen-devel@lists.xenproject.org On 17/06/15 16:26, Jan Beulich wrote: > Commit 213f145114 ("gnttab: fix/adjust gnttab_transfer()") wasn't > careful enough in this regard. > > Coverity ID: 1306859 > Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper > > --- a/xen/common/grant_table.c > +++ b/xen/common/grant_table.c > @@ -1726,7 +1726,8 @@ gnttab_transfer( > max_bitsize = domain_clamp_alloc_bitsize( > e, e->grant_table->gt_version > 1 || paging_mode_translate(e) > ? BITS_PER_LONG + PAGE_SHIFT : 32 + PAGE_SHIFT); > - if ( (1UL << (max_bitsize - PAGE_SHIFT)) <= mfn ) > + if ( max_bitsize < BITS_PER_LONG + PAGE_SHIFT && > + (mfn >> (max_bitsize - PAGE_SHIFT)) ) > { > struct page_info *new_page; > > > >