From: "Jan Beulich" Subject: [PATCH v2 1/3 resend] gnttab: fix out of range shift count Date: Mon, 22 Jun 2015 12:44:59 +0100 Message-ID: <5588115B0200007800087759@mail.emea.novell.com> References: <558810070200007800087749@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part6450BB2B.1__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z709w-0001Fj-Jh for xen-devel@lists.xenproject.org; Mon, 22 Jun 2015 11:45:04 +0000 In-Reply-To: <558810070200007800087749@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: xen-devel Cc: Ian Campbell , 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. --=__Part6450BB2B.1__= 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 Reviewed-by: Andrew Cooper --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -1829,7 +1829,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 --=__Part6450BB2B.1__= 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= Reviewed-by: Andrew Cooper =0A=0A--- a/xen/commo= n/grant_table.c=0A+++ b/xen/common/grant_table.c=0A@@ -1829,7 +1829,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 --=__Part6450BB2B.1__= 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 --=__Part6450BB2B.1__=--