|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] libxc: adjust string size calculations in xc_flask_{getbool_byname,setbool}()
commit 40e93479999a9c6e227340fdb5ffa877292294bf
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jul 1 14:10:46 2026 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jul 1 14:10:46 2026 +0200
libxc: adjust string size calculations in
xc_flask_{getbool_byname,setbool}()
In preparation for a hypervisor change also include the nul terminator in
the size calculations. (Note that xc_flask_getbool_byid() doesn't support
FLASK_GETBOOL's "ID being -1" variant of operation, and hence doesn't need
fiddling with.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
Reviewed-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
Acked-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
tools/libs/ctrl/xc_flask.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/libs/ctrl/xc_flask.c b/tools/libs/ctrl/xc_flask.c
index 21ba697ad6..f5389dbd96 100644
--- a/tools/libs/ctrl/xc_flask.c
+++ b/tools/libs/ctrl/xc_flask.c
@@ -186,7 +186,8 @@ int xc_flask_getbool_byname(xc_interface *xch, char *name,
int *curr, int *pend)
{
int rv;
struct xen_flask_op op = {};
- DECLARE_HYPERCALL_BOUNCE(name, strlen(name),
XC_HYPERCALL_BUFFER_BOUNCE_IN);
+ size_t size = strlen(name) + 1;
+ DECLARE_HYPERCALL_BOUNCE(name, size, XC_HYPERCALL_BUFFER_BOUNCE_IN);
if ( xc_hypercall_bounce_pre(xch, name) )
{
@@ -196,7 +197,7 @@ int xc_flask_getbool_byname(xc_interface *xch, char *name,
int *curr, int *pend)
op.cmd = FLASK_GETBOOL;
op.u.boolean.bool_id = -1;
- op.u.boolean.size = strlen(name);
+ op.u.boolean.size = size;
set_xen_guest_handle(op.u.boolean.name, name);
rv = xc_flask_op(xch, &op);
@@ -218,7 +219,8 @@ int xc_flask_setbool(xc_interface *xch, char *name, int
value, int commit)
{
int rv;
struct xen_flask_op op = {};
- DECLARE_HYPERCALL_BOUNCE(name, strlen(name),
XC_HYPERCALL_BUFFER_BOUNCE_IN);
+ size_t size = strlen(name) + 1;
+ DECLARE_HYPERCALL_BOUNCE(name, size, XC_HYPERCALL_BUFFER_BOUNCE_IN);
if ( xc_hypercall_bounce_pre(xch, name) )
{
@@ -230,7 +232,7 @@ int xc_flask_setbool(xc_interface *xch, char *name, int
value, int commit)
op.u.boolean.bool_id = -1;
op.u.boolean.new_value = value;
op.u.boolean.commit = 1;
- op.u.boolean.size = strlen(name);
+ op.u.boolean.size = size;
set_xen_guest_handle(op.u.boolean.name, name);
rv = xc_flask_op(xch, &op);
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |