From: David Gibson <dwg@au1.ibm.com>
To: Alexander Graf <agraf@suse.de>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [PATCH] spapr_vscsi: Set uninitialized variable
Date: Tue, 5 Apr 2011 14:14:59 +1000 [thread overview]
Message-ID: <20110405041459.GC466@yookeroo> (raw)
In-Reply-To: <4D99DDD0.5070107@suse.de>
On Mon, Apr 04, 2011 at 05:03:44PM +0200, Alexander Graf wrote:
> On 04/03/2011 06:21 PM, Stefan Weil wrote:
> >cppcheck reports this error:
> >
> >hw/spapr_vscsi.c:274: error: Uninitialized variable: rc
> >
> >If llen == 0, rc was indeed used without being initialized.
> >
> >Signed-off-by: Stefan Weil<weil@mail.berlios.de>
> >---
> > hw/spapr_vscsi.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> >diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
> >index e142dae..9928334 100644
> >--- a/hw/spapr_vscsi.c
> >+++ b/hw/spapr_vscsi.c
> >@@ -255,7 +255,7 @@ static int vscsi_srp_direct_data(VSCSIState *s, vscsi_req *req,
> > {
> > struct srp_direct_buf *md = req->cur_desc;
> > uint32_t llen;
> >- int rc;
> >+ int rc = 0;
>
> David, is this correct? Or would rc be -1 when !llen?
I talked to Ben, who wrote this code - apparently his mail server blew
up. This patch should be correct, AFAWCT. It's not totally clear
what the right return value should be in thie case, or indeed that
this case ever actually happens, but we think 0 is right.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2011-04-05 4:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-03 16:21 [Qemu-devel] [PATCH] spapr_vscsi: Set uninitialized variable Stefan Weil
2011-04-04 15:03 ` [Qemu-devel] " Alexander Graf
2011-04-05 4:14 ` David Gibson [this message]
2011-04-05 5:04 ` Benjamin Herrenschmidt
2011-04-05 7:55 ` Alexander Graf
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=20110405041459.GC466@yookeroo \
--to=dwg@au1.ibm.com \
--cc=agraf@suse.de \
--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).