Instead, special case GRUB1 rather assuming that all bootloaders except GRUB2
need a parameter stripping.

Signed-off-by: Wei Liu <wei.l...@citrix.com>
Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
---
 xen/arch/x86/setup.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 353cdd4337..4dff2bca8b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -617,11 +617,12 @@ static void __init noreturn reinit_bsp_stack(void)
     reset_stack_and_jump(init_done);
 }
 
-static bool __init loader_is_grub2(const char *loader_name)
+static bool __init loader_is_grub1(const char *loader_name)
 {
     /* GRUB1="GNU GRUB 0.xx"; GRUB2="GRUB 1.xx" */
     const char *p = strstr(loader_name, "GRUB ");
-    return (p != NULL) && (p[5] != '0');
+
+    return p && p[5] == '0';
 }
 
 static char * __init cmdline_cook(char *p, const char *loader_name)
@@ -632,11 +633,10 @@ static char * __init cmdline_cook(char *p, const char 
*loader_name)
     while ( *p == ' ' )
         p++;
 
-    /* GRUB2 does not include image name as first item on command line. */
-    if ( loader_is_grub2(loader_name) )
+    if ( !loader_is_grub1(loader_name) )
         return p;
 
-    /* Strip image name plus whitespace. */
+    /* GRUB1 includes the image name as first item on command line. Strip it. 
*/
     while ( (*p != ' ') && (*p != '\0') )
         p++;
     while ( *p == ' ' )
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to