From: "Jan Beulich" Subject: [PATCH 1/5] x86: don't BUG() post-boot in alloc_xen_pagetable() Date: Wed, 09 Mar 2011 10:54:39 +0000 Message-ID: <4D776A7F020000780003575C@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part715D467F.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" 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. --=__Part715D467F.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Instead, propagate the condition to the caller, all of which also get adjusted to check for that situation. Signed-off-by: Jan Beulich --- 2011-03-09.orig/xen/arch/x86/mm.c +++ 2011-03-09/xen/arch/x86/mm.c @@ -5141,8 +5141,11 @@ int map_pages_to_xen( while ( nr_mfns !=3D 0 ) { #ifdef __x86_64__ - l3_pgentry_t *pl3e =3D virt_to_xen_l3e(virt); - l3_pgentry_t ol3e =3D *pl3e; + l3_pgentry_t ol3e, *pl3e =3D virt_to_xen_l3e(virt); + + if ( !pl3e ) + return -ENOMEM; + ol3e =3D *pl3e; =20 if ( cpu_has_page1gb && !(((virt >> PAGE_SHIFT) | mfn) & @@ -5262,6 +5265,8 @@ int map_pages_to_xen( #endif =20 pl2e =3D virt_to_xen_l2e(virt); + if ( !pl2e ) + return -ENOMEM; =20 if ( ((((virt>>PAGE_SHIFT) | mfn) & ((1<=3D (1<=0A=0A--- 2011-03-09.orig/xen/arch/x86/mm.c=0A= +++ 2011-03-09/xen/arch/x86/mm.c=0A@@ -5141,8 +5141,11 @@ int map_pages_to_= xen(=0A while ( nr_mfns !=3D 0 )=0A {=0A #ifdef __x86_64__=0A- = l3_pgentry_t *pl3e =3D virt_to_xen_l3e(virt);=0A- l3_pgentry_t = ol3e =3D *pl3e;=0A+ l3_pgentry_t ol3e, *pl3e =3D virt_to_xen_l3e(vir= t);=0A+=0A+ if ( !pl3e )=0A+ return -ENOMEM;=0A+ = ol3e =3D *pl3e;=0A =0A if ( cpu_has_page1gb &&=0A = !(((virt >> PAGE_SHIFT) | mfn) &=0A@@ -5262,6 +5265,8 @@ int map_pages_to_x= en(=0A #endif=0A =0A pl2e =3D virt_to_xen_l2e(virt);=0A+ if = ( !pl2e )=0A+ return -ENOMEM;=0A =0A if ( ((((virt>>PAGE= _SHIFT) | mfn) & ((1<=3D (1<