All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel@lists.xenproject.org, oleksii.kurochko@gmail.com,
	Anthony PERARD <anthony.perard@vates.tech>,
	Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH for-4.21 1/6] tools/{lib,}xl: fix usage of error return from json_tokener_parse_verbose()
Date: Wed, 15 Oct 2025 16:25:01 +0200	[thread overview]
Message-ID: <aO-uvRMvSsz7w9Qw@Mac.lan> (raw)
In-Reply-To: <096f8bea-f8aa-46cb-9d05-2d222d517fad@citrix.com>

On Wed, Oct 15, 2025 at 02:59:25PM +0100, Andrew Cooper wrote:
> On 15/10/2025 2:40 pm, Roger Pau Monne wrote:
> > diff --git a/tools/libs/light/libxl_json.c b/tools/libs/light/libxl_json.c
> > index c76ae9f64a9d..a9e06b06932d 100644
> > --- a/tools/libs/light/libxl_json.c
> > +++ b/tools/libs/light/libxl_json.c
> > @@ -1366,11 +1366,13 @@ libxl__json_object *libxl__json_parse(libxl__gc *gc, const char *s)
> >      libxl__json_object *o = NULL;
> >  #ifdef USE_LIBJSONC_PARSER
> >      json_object *jso;
> > -    enum json_tokener_error error;
> > +    enum json_tokener_error error = json_tokener_success;
> 
> Looking at the options available, I'd suggest initialising to:
> 
>     json_tokener_error_parse_unexpected
> 
> and dropping the rest of the hunk.  I wouldn't assume that success
> cannot be passed here.

That error code translates to "unexpected character", which I didn't
think was very accurate here.  I didn't find any good error code to
map here, hence why I went with this kind of weird solution.

I don't mind using json_tokener_error_parse_unexpected, just
mentioning why I didn't use it in the first place.  Anthony, what's
your opinion?

Thanks, Roger.


  reply	other threads:[~2025-10-15 14:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 13:40 [PATCH for-4.21 0/6] tools/{lib,}xl: Coverity falllout from the json-c switch Roger Pau Monne
2025-10-15 13:40 ` [PATCH for-4.21 1/6] tools/{lib,}xl: fix usage of error return from json_tokener_parse_verbose() Roger Pau Monne
2025-10-15 13:59   ` Andrew Cooper
2025-10-15 14:25     ` Roger Pau Monné [this message]
2025-10-15 13:40 ` [PATCH for-4.21 2/6] tools/libxl: avoid freeing stack rubble in libxl__json_object_to_json() Roger Pau Monne
2025-10-15 18:50   ` Jason Andryuk
2025-10-15 13:40 ` [PATCH for-4.21 3/6] tools/xl: check return of json_object_object_add() Roger Pau Monne
2025-10-15 18:51   ` Jason Andryuk
2025-10-15 13:40 ` [PATCH for-4.21 4/6] tools/xl: check return value of printf_info_one_json() in list_domains_details() Roger Pau Monne
2025-10-15 18:52   ` Jason Andryuk
2025-10-15 13:40 ` [PATCH for-4.21 5/6] tools/xl: fix possible uninitialized usage in printf_info() Roger Pau Monne
2025-10-15 18:53   ` Jason Andryuk
2025-10-15 13:40 ` [PATCH for-4.21 6/6] github/coverity: switch to building with json-c instead of yajl Roger Pau Monne
2025-10-15 18:53   ` Jason Andryuk
2025-10-15 15:00 ` [PATCH for-4.21 0/6] tools/{lib,}xl: Coverity falllout from the json-c switch Oleksii Kurochko
2025-10-15 15:04 ` Andrew Cooper
2025-10-15 16:50   ` Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aO-uvRMvSsz7w9Qw@Mac.lan \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=jgross@suse.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.