[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] tools/xl: fix possible uninitialized usage in printf_info()



commit 439ebb08081f8ca01d52d0aecf4b3aed895f40c9
Author:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Wed Oct 15 14:23:45 2025 +0200
Commit:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
CommitDate: Thu Oct 16 17:20:38 2025 +0200

    tools/xl: fix possible uninitialized usage in printf_info()
    
    printf_info_one_json() won't initialize the passed jso_r parameter on
    error, and hence the usage in printf_info() needs prior initialization,
    otherwise an uninitialized pointer is passed to json_object_put() on
    failure.
    
    Reported by the internal XenServer Coverity instance.
    
    Fixes: f6c6f2679d49 ("libxl: Convert libxl__object_to_json() to json-c")
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
 tools/xl/xl_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c
index 61243bd558..dbb682cc52 100644
--- a/tools/xl/xl_info.c
+++ b/tools/xl/xl_info.c
@@ -154,7 +154,7 @@ void printf_info(enum output_format output_format,
 #ifdef HAVE_LIBJSONC
     int r;
     const char *buf;
-    json_object *jso;
+    json_object *jso = NULL;
 
     r = printf_info_one_json(&jso, domid, d_config);
     if (r)
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.