[4/8] tools/libxc: misc: Mark const the parameter 'params' of xc_set_parameters()
diff mbox series

Message ID 20200330192157.1335-5-julien@xen.org
State New
Headers show
Series
  • Fix build with using OCaml 4.06.1 and -safe-string
Related show

Commit Message

Julien Grall March 30, 2020, 7:21 p.m. UTC
From: Julien Grall <jgrall@amazon.com>

The parameter 'params' of xc_set_parameters() should never be modified.
So mark it as const.

Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 tools/libxc/include/xenctrl.h | 2 +-
 tools/libxc/xc_misc.c         | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Ian Jackson March 31, 2020, 11:14 a.m. UTC | #1
Julien Grall writes ("[PATCH 4/8] tools/libxc: misc: Mark const the parameter 'params' of xc_set_parameters()"):
> From: Julien Grall <jgrall@amazon.com>
> 
> The parameter 'params' of xc_set_parameters() should never be modified.
> So mark it as const.

Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>

Patch
diff mbox series

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index d8874eb846..58fa931de1 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1226,7 +1226,7 @@  int xc_readconsolering(xc_interface *xch,
                        int clear, int incremental, uint32_t *pindex);
 
 int xc_send_debug_keys(xc_interface *xch, const char *keys);
-int xc_set_parameters(xc_interface *xch, char *params);
+int xc_set_parameters(xc_interface *xch, const char *params);
 
 typedef struct xen_sysctl_physinfo xc_physinfo_t;
 typedef struct xen_sysctl_cputopo xc_cputopo_t;
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index 957c03415c..fe477bf344 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -187,11 +187,11 @@  int xc_send_debug_keys(xc_interface *xch, const char *keys)
     return ret;
 }
 
-int xc_set_parameters(xc_interface *xch, char *params)
+int xc_set_parameters(xc_interface *xch, const char *params)
 {
     int ret, len = strlen(params);
     DECLARE_SYSCTL;
-    DECLARE_HYPERCALL_BOUNCE(params, len, XC_HYPERCALL_BUFFER_BOUNCE_IN);
+    DECLARE_HYPERCALL_BOUNCE_IN(params, len);
 
     if ( xc_hypercall_bounce_pre(xch, params) )
         return -1;