[PATCH for-4.21 0/6] tools/{lib,}xl: Coverity falllout from the json-c switch

Roger Pau Monne posted 6 patches 2 weeks, 1 day ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20251015134043.72316-1-roger.pau@citrix.com
.github/workflows/coverity.yml |  2 +-
tools/libs/light/libxl_json.c  |  8 +++++---
tools/xl/xl_info.c             | 22 +++++++++++++++-------
3 files changed, 21 insertions(+), 11 deletions(-)
[PATCH for-4.21 0/6] tools/{lib,}xl: Coverity falllout from the json-c switch
Posted by Roger Pau Monne 2 weeks, 1 day ago
Hello,

The following series contains fixes for Coverity reported issues after
the switch from YAJL to json-c.  Those reports are from the internal
XenServer Coverity instance, as the project one hasn't been switched to
use json-c yet, last patch in the series switches thegithub triggered
Coverity build to use json-c.

All should be considered for 4.21.

Thanks, Roger.

Roger Pau Monne (6):
  tools/{lib,}xl: fix usage of error return from
    json_tokener_parse_verbose()
  tools/libxl: avoid freeing stack rubble in
    libxl__json_object_to_json()
  tools/xl: check return of json_object_object_add()
  tools/xl: check return value of printf_info_one_json() in
    list_domains_details()
  tools/xl: fix possible uninitialized usage in printf_info()
  github/coverity: switch to building with json-c instead of yajl

 .github/workflows/coverity.yml |  2 +-
 tools/libs/light/libxl_json.c  |  8 +++++---
 tools/xl/xl_info.c             | 22 +++++++++++++++-------
 3 files changed, 21 insertions(+), 11 deletions(-)

-- 
2.51.0
Re: [PATCH for-4.21 0/6] tools/{lib,}xl: Coverity falllout from the json-c switch
Posted by Andrew Cooper 2 weeks, 1 day ago
On 15/10/2025 2:40 pm, Roger Pau Monne wrote:
> Hello,
>
> The following series contains fixes for Coverity reported issues after
> the switch from YAJL to json-c.  Those reports are from the internal
> XenServer Coverity instance, as the project one hasn't been switched to
> use json-c yet, last patch in the series switches thegithub triggered
> Coverity build to use json-c.
>
> All should be considered for 4.21.
>
> Thanks, Roger.
>
> Roger Pau Monne (6):
>   tools/{lib,}xl: fix usage of error return from
>     json_tokener_parse_verbose()
>   tools/libxl: avoid freeing stack rubble in
>     libxl__json_object_to_json()
>   tools/xl: check return of json_object_object_add()
>   tools/xl: check return value of printf_info_one_json() in
>     list_domains_details()
>   tools/xl: fix possible uninitialized usage in printf_info()
>   github/coverity: switch to building with json-c instead of yajl

Other than my query on patch 1, everything else LGTM.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Thankyou for looking at these.
Re: [PATCH for-4.21 0/6] tools/{lib,}xl: Coverity falllout from the json-c switch
Posted by Roger Pau Monné 2 weeks ago
On Wed, Oct 15, 2025 at 04:04:06PM +0100, Andrew Cooper wrote:
> On 15/10/2025 2:40 pm, Roger Pau Monne wrote:
> > Hello,
> >
> > The following series contains fixes for Coverity reported issues after
> > the switch from YAJL to json-c.  Those reports are from the internal
> > XenServer Coverity instance, as the project one hasn't been switched to
> > use json-c yet, last patch in the series switches thegithub triggered
> > Coverity build to use json-c.
> >
> > All should be considered for 4.21.
> >
> > Thanks, Roger.
> >
> > Roger Pau Monne (6):
> >   tools/{lib,}xl: fix usage of error return from
> >     json_tokener_parse_verbose()
> >   tools/libxl: avoid freeing stack rubble in
> >     libxl__json_object_to_json()
> >   tools/xl: check return of json_object_object_add()
> >   tools/xl: check return value of printf_info_one_json() in
> >     list_domains_details()
> >   tools/xl: fix possible uninitialized usage in printf_info()
> >   github/coverity: switch to building with json-c instead of yajl
> 
> Other than my query on patch 1, everything else LGTM.
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Thanks, if no one else expresses an opinion by tomorrow I will apply
your comment and commit.

Roger.
Re: [PATCH for-4.21 0/6] tools/{lib,}xl: Coverity falllout from the json-c switch
Posted by Oleksii Kurochko 2 weeks, 1 day ago
On 10/15/25 3:40 PM, Roger Pau Monne wrote:
> Hello,
>
> The following series contains fixes for Coverity reported issues after
> the switch from YAJL to json-c.  Those reports are from the internal
> XenServer Coverity instance, as the project one hasn't been switched to
> use json-c yet, last patch in the series switches thegithub triggered
> Coverity build to use json-c.
>
> All should be considered for 4.21.

Agree, we could consider that to have that in 4.21 as it fixes some minor
problems and isn't too intrusive:
  Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>

Thanks.

~ Oleksii

>
> Thanks, Roger.
>
> Roger Pau Monne (6):
>    tools/{lib,}xl: fix usage of error return from
>      json_tokener_parse_verbose()
>    tools/libxl: avoid freeing stack rubble in
>      libxl__json_object_to_json()
>    tools/xl: check return of json_object_object_add()
>    tools/xl: check return value of printf_info_one_json() in
>      list_domains_details()
>    tools/xl: fix possible uninitialized usage in printf_info()
>    github/coverity: switch to building with json-c instead of yajl
>
>   .github/workflows/coverity.yml |  2 +-
>   tools/libs/light/libxl_json.c  |  8 +++++---
>   tools/xl/xl_info.c             | 22 +++++++++++++++-------
>   3 files changed, 21 insertions(+), 11 deletions(-)
>