lguest: assume Switcher text is a single page.
ie. SHARED_SWITCHER_PAGES == 1. It is well under a page, and it's a
minor simplification: it's nice to have *one* simplification in a
patch series!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 211d826..4209065 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -52,6 +52,13 @@
* easy.
*/
+ /* We assume Switcher text fits into a single page. */
+ if (end_switcher_text - start_switcher_text > PAGE_SIZE) {
+ printk(KERN_ERR "lguest: switcher text too large (%zu)\n",
+ end_switcher_text - start_switcher_text);
+ return -EINVAL;
+ }
+
/*
* We allocate an array of struct page pointers. map_vm_area() wants
* this, rather than just an array of pages.
@@ -326,7 +333,7 @@
goto out;
/* Now we set up the pagetable implementation for the Guests. */
- err = init_pagetables(switcher_pages, SHARED_SWITCHER_PAGES);
+ err = init_pagetables(switcher_pages);
if (err)
goto unmap;