From: "Jan Beulich" Subject: [PATCH] gnttab: fix out of range shift count Date: Wed, 17 Jun 2015 16:26:20 +0100 Message-ID: <5581ADBC020000780008647D@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartA195788C.2__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z5FEP-0000Wf-4o for xen-devel@lists.xenproject.org; Wed, 17 Jun 2015 15:26:25 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Ian Campbell , Andrew Cooper , Keir Fraser , Ian Jackson , Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartA195788C.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Commit 213f145114 ("gnttab: fix/adjust gnttab_transfer()") wasn't careful enough in this regard. Coverity ID: 1306859 Signed-off-by: Jan Beulich --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -1726,7 +1726,8 @@ gnttab_transfer( max_bitsize =3D 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)) <=3D mfn ) + if ( max_bitsize < BITS_PER_LONG + PAGE_SHIFT && + (mfn >> (max_bitsize - PAGE_SHIFT)) ) { struct page_info *new_page; =20 --=__PartA195788C.2__= Content-Type: text/plain; name="gnttab-transfer-shift-count.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="gnttab-transfer-shift-count.patch" gnttab: fix out of range shift count=0A=0ACommit 213f145114 ("gnttab: = fix/adjust gnttab_transfer()") wasn't=0Acareful enough in this regard.=0A= =0ACoverity ID: 1306859=0ASigned-off-by: Jan Beulich =0A= =0A--- a/xen/common/grant_table.c=0A+++ b/xen/common/grant_table.c=0A@@ = -1726,7 +1726,8 @@ gnttab_transfer(=0A max_bitsize =3D domain_clamp= _alloc_bitsize(=0A e, e->grant_table->gt_version > 1 || = paging_mode_translate(e)=0A ? BITS_PER_LONG + PAGE_SHIFT : = 32 + PAGE_SHIFT);=0A- if ( (1UL << (max_bitsize - PAGE_SHIFT)) <=3D = mfn )=0A+ if ( max_bitsize < BITS_PER_LONG + PAGE_SHIFT &&=0A+ = (mfn >> (max_bitsize - PAGE_SHIFT)) )=0A {=0A = struct page_info *new_page;=0A =0A --=__PartA195788C.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartA195788C.2__=--