aboutsummaryrefslogtreecommitdiffstats
path: root/main/xen/xen-Fix-backport-of-xen-cmdline-Fix-buggy-strncmp-s-.patch
blob: 4a822e6227290ffb9462d84866c7503801e6a82b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From eb8acba82ad00cf3499de8dbd52cdc813b2d64e2 Mon Sep 17 00:00:00 2001
From: Andrew Cooper <andrew.cooper3@citrix.com>
Date: Fri, 3 May 2019 10:52:32 +0200
Subject: [PATCH] xen: Fix backport of "xen/cmdline: Fix buggy strncmp(s,
 LITERAL, ss - s) construct"

These were missed as a consequence of being rebased over other cmdline
cleanup.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/dom0_build.c   | 4 ++--
 xen/arch/x86/hvm/vmx/vmcs.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index b744791c38..dbd7d0d393 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -237,10 +237,10 @@ static int __init parse_dom0_param(const char *s)
         if ( !ss )
             ss = strchr(s, '\0');
 
-        if ( !strncmp(s, "pvh", ss - s) )
+        if ( !cmdline_strcmp(s, "pvh") )
             dom0_pvh = true;
 #ifdef CONFIG_SHADOW_PAGING
-        else if ( !strncmp(s, "shadow", ss - s) )
+        else if ( !cmdline_strcmp(s, "shadow") )
             opt_dom0_shadow = true;
 #endif
         else
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 49c916b82d..19755f2716 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -90,9 +90,9 @@ static int __init parse_ept_param(const char *s)
         if ( !ss )
             ss = strchr(s, '\0');
 
-        if ( !strncmp(s, "pml", ss - s) )
+        if ( !cmdline_strcmp(s, "pml") )
             opt_pml_enabled = val;
-        else if ( !strncmp(s, "ad", ss - s) )
+        else if ( !cmdline_strcmp(s, "ad") )
             opt_ept_ad = val;
         else
             rc = -EINVAL;
-- 
2.20.1