x86/xen: panic on bad Xen-provided memory map
authorMartin Kelly <martin@martingkelly.com>
Fri, 17 Oct 2014 03:48:11 +0000 (20:48 -0700)
committerDavid Vrabel <david.vrabel@citrix.com>
Thu, 23 Oct 2014 15:24:02 +0000 (16:24 +0100)
Panic if Xen provides a memory map with 0 entries. Although this is
unlikely, it is better to catch the error at the point of seeing the map
than later on as a symptom of some other crash.

Signed-off-by: Martin Kelly <martkell@amazon.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
arch/x86/xen/setup.c

index af7216128d93ac4949e574b52d45f91079f6898f..29834b3fd87f8eba807d5b969f09085f857ceeb9 100644 (file)
@@ -595,6 +595,7 @@ char * __init xen_memory_setup(void)
                rc = 0;
        }
        BUG_ON(rc);
+       BUG_ON(memmap.nr_entries == 0);
 
        /*
         * Xen won't allow a 1:1 mapping to be created to UNUSABLE