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

[PATCH for-4.21 5/6] tools/xl: fix possible uninitialized usage in printf_info()


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Wed, 15 Oct 2025 15:40:42 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yAZenEHHSJc9XuumDpKzapOsydcxgd6TjINpy1Ft2iE=; b=bukHzepcWiIfWk30DaTWs1OaVr/9pqNIsUNGSqHN+qQ2XeBgvQcIP0O95QMeuhXRoR9qVSpwA0KLyCsa81lvLtYLFa0fA3ZZgZ6w9SdU2nNZjctzkOmHC7xE0+nyYHeqK3Mx4Q+mjOjTbkrgeEk7nTUjM1zkNoSheqVtpisesp245JSKNU6AXWR39URajEtndYNfb59cYqiIxg7QDgw950shTcv70u/Z1vtFqWsaT7rp62r9E7YBB5kC648ElX1qzLSCyv9boVTyqs6GJisjCQusNguaJL7JoF8+3sXp17GniXPJr2uv0jJc26zNCjdxfMrFlNdEkMVwhOGzAP2EHw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F9tktHKpTpp8m+KVrQIxfYXz+xLxjHIGP2kwPsmdlgf2C3CIjBDdycmO/pYs+mLAoScALRkkXonm4h+R2fWuM2J3r5Z2Uix5SM8ITQ7FRzNwJcXzldX/8bBawX/mg8SACFicuZDqyng57d9PsdCKJYu+rNul//5/J3PQeVJbl0KfChlXxcg+vRcmOeKqRHdeeWRMRuf0xDR8wq/X1Tk5ZL/1i+nxQmEhFv46yjVSKZaUFoMdjSJ9xRzu7nV1c/5k0erlkeDt/i6M7dIVMW2bosS680/78QZoYTeYjZ9FJJqis2uiN3k79jjd2JVcF1twFC/Dro9JIlS5f90VouuaNg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: oleksii.kurochko@xxxxxxxxx, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Wed, 15 Oct 2025 13:48:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>
---
 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 696f1f7423cb..0314ce7d4c22 100644
--- a/tools/xl/xl_info.c
+++ b/tools/xl/xl_info.c
@@ -155,7 +155,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)
-- 
2.51.0




 


Rackspace

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