From: Jeff Cody <jcody@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, patches@linaro.org,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block/gluster.c: Handle qdict_array_entries() failure
Date: Mon, 5 Jun 2017 16:34:13 -0400 [thread overview]
Message-ID: <20170605203413.GB2680@localhost.localdomain> (raw)
In-Reply-To: <1496682098-1540-1-git-send-email-peter.maydell@linaro.org>
On Mon, Jun 05, 2017 at 06:01:38PM +0100, Peter Maydell wrote:
> In qemu_gluster_parse_json(), the call to qdict_array_entries()
> could return a negative error code, which we were ignoring
> because we assigned the result to an unsigned variable.
> Fix this by using the 'int' type instead, which matches the
> return type of qdict_array_entries() and also the type
> we use for the loop enumeration variable 'i'.
>
> (Spotted by Coverity, CID 1360960.)
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> block/gluster.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/block/gluster.c b/block/gluster.c
> index 031596a..addceed 100644
> --- a/block/gluster.c
> +++ b/block/gluster.c
> @@ -493,8 +493,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
> Error *local_err = NULL;
> char *str = NULL;
> const char *ptr;
> - size_t num_servers;
> - int i, type;
> + int i, type, num_servers;
>
> /* create opts info from runtime_json_opts list */
> opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort);
> --
> 2.7.4
>
Thanks,
Reviewed-by: Jeff Cody <jcody@redhat.com>
Also - applied to my block branch:
git://github.com/codyprime/qemu-kvm-jtc block
-Jeff
prev parent reply other threads:[~2017-06-05 20:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 17:01 [Qemu-devel] [PATCH] block/gluster.c: Handle qdict_array_entries() failure Peter Maydell
2017-06-05 17:48 ` Eric Blake
2017-06-05 20:14 ` Philippe Mathieu-Daudé
2017-06-05 20:34 ` Jeff Cody [this message]
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=20170605203413.GB2680@localhost.localdomain \
--to=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).