Message ID | 1401283300-14176-4-git-send-email-arei.gonglei@huawei.com |
---|---|
State | New |
Headers | show |
Il 28/05/2014 15:21, arei.gonglei@huawei.com ha scritto: > From: Gonglei <arei.gonglei@huawei.com> > > Pointer "token" returned by "parser_context_pop_token(ctxt)" is never used. > > Signed-off-by: ChenLiang <chenliang88@huawei.com> > Signed-off-by: Gonglei <arei.gonglei@huawei.com> > --- > qobject/json-parser.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) > > diff --git a/qobject/json-parser.c b/qobject/json-parser.c > index e46c264..4288267 100644 > --- a/qobject/json-parser.c > +++ b/qobject/json-parser.c > @@ -423,7 +423,6 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) > if (!token_is_operator(token, '{')) { > goto out; > } > - token = NULL; > > dict = qdict_new(); > > @@ -449,7 +448,6 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) > parse_error(ctxt, token, "expected separator in dict"); > goto out; > } > - token = NULL; > > if (parse_pair(ctxt, dict, ap) == -1) { > goto out; > @@ -461,10 +459,8 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) > goto out; > } > } > - token = NULL; > } else { > - token = parser_context_pop_token(ctxt); > - token = NULL; > + (void)parser_context_pop_token(ctxt); > } > > return QOBJECT(dict); > @@ -487,10 +483,8 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) > } > > if (!token_is_operator(token, '[')) { > - token = NULL; > goto out; > } > - token = NULL; > > list = qlist_new(); > > @@ -523,8 +517,6 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) > goto out; > } > > - token = NULL; > - > obj = parse_value(ctxt, ap); > if (obj == NULL) { > parse_error(ctxt, token, "expecting value"); > @@ -539,11 +531,8 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) > goto out; > } > } > - > - token = NULL; > } else { > - token = parser_context_pop_token(ctxt); > - token = NULL; > + (void)parser_context_pop_token(ctxt); > } > > return QOBJECT(list); > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
On Wed, 28 May 2014 21:21:37 +0800 <arei.gonglei@huawei.com> wrote: > From: Gonglei <arei.gonglei@huawei.com> > > Pointer "token" returned by "parser_context_pop_token(ctxt)" is never used. That's not true, "token" is used by token_is_operator(). The patch seems correct to me, but you have to fix the changelog. Also, who's going to take care of this series? I'm willing to cherry-pick this patch... > > Signed-off-by: ChenLiang <chenliang88@huawei.com> > Signed-off-by: Gonglei <arei.gonglei@huawei.com> > --- > qobject/json-parser.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) > > diff --git a/qobject/json-parser.c b/qobject/json-parser.c > index e46c264..4288267 100644 > --- a/qobject/json-parser.c > +++ b/qobject/json-parser.c > @@ -423,7 +423,6 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) > if (!token_is_operator(token, '{')) { > goto out; > } > - token = NULL; > > dict = qdict_new(); > > @@ -449,7 +448,6 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) > parse_error(ctxt, token, "expected separator in dict"); > goto out; > } > - token = NULL; > > if (parse_pair(ctxt, dict, ap) == -1) { > goto out; > @@ -461,10 +459,8 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) > goto out; > } > } > - token = NULL; > } else { > - token = parser_context_pop_token(ctxt); > - token = NULL; > + (void)parser_context_pop_token(ctxt); > } > > return QOBJECT(dict); > @@ -487,10 +483,8 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) > } > > if (!token_is_operator(token, '[')) { > - token = NULL; > goto out; > } > - token = NULL; > > list = qlist_new(); > > @@ -523,8 +517,6 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) > goto out; > } > > - token = NULL; > - > obj = parse_value(ctxt, ap); > if (obj == NULL) { > parse_error(ctxt, token, "expecting value"); > @@ -539,11 +531,8 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) > goto out; > } > } > - > - token = NULL; > } else { > - token = parser_context_pop_token(ctxt); > - token = NULL; > + (void)parser_context_pop_token(ctxt); > } > > return QOBJECT(list);
> -----Original Message----- > From: Luiz Capitulino [mailto:lcapitulino@redhat.com] > Sent: Tuesday, June 10, 2014 4:16 AM > To: Gonglei (Arei) > Cc: qemu-devel@nongnu.org; av1474@comtv.ru; kraxel@redhat.com; > lersek@redhat.com; qiaonuohan@cn.fujitsu.com; afaerber@suse.de; > eblake@redhat.com; pbonzini@redhat.com; mst@redhat.com; Huangweidong > (C); peter.crosthwaite@xilinx.com; kwolf@redhat.com; stefanha@redhat.com; > crobinso@redhat.com; aliguori@amazon.com; armbru@redhat.com; > Luonengjun; chenliang (T) > Subject: Re: [PATCH v2 3/6] json-parser: Fix two coverity defects > > On Wed, 28 May 2014 21:21:37 +0800 > <arei.gonglei@huawei.com> wrote: > > > From: Gonglei <arei.gonglei@huawei.com> > > > > Pointer "token" returned by "parser_context_pop_token(ctxt)" is never used. > > That's not true, "token" is used by token_is_operator(). The patch seems > correct to me, but you have to fix the changelog. > OK. > Also, who's going to take care of this series? I'm willing to cherry-pick > this patch... > Thanks. As this patch series, [PATCH 1/6] vnc-enc-tight... had been applied by Gerd, the others haven't. I will send v3 for other patches, hope to be applied, thanks! Best regards, -Gonglei
diff --git a/qobject/json-parser.c b/qobject/json-parser.c index e46c264..4288267 100644 --- a/qobject/json-parser.c +++ b/qobject/json-parser.c @@ -423,7 +423,6 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) if (!token_is_operator(token, '{')) { goto out; } - token = NULL; dict = qdict_new(); @@ -449,7 +448,6 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) parse_error(ctxt, token, "expected separator in dict"); goto out; } - token = NULL; if (parse_pair(ctxt, dict, ap) == -1) { goto out; @@ -461,10 +459,8 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap) goto out; } } - token = NULL; } else { - token = parser_context_pop_token(ctxt); - token = NULL; + (void)parser_context_pop_token(ctxt); } return QOBJECT(dict); @@ -487,10 +483,8 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) } if (!token_is_operator(token, '[')) { - token = NULL; goto out; } - token = NULL; list = qlist_new(); @@ -523,8 +517,6 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) goto out; } - token = NULL; - obj = parse_value(ctxt, ap); if (obj == NULL) { parse_error(ctxt, token, "expecting value"); @@ -539,11 +531,8 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap) goto out; } } - - token = NULL; } else { - token = parser_context_pop_token(ctxt); - token = NULL; + (void)parser_context_pop_token(ctxt); } return QOBJECT(list);