aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2017-08-09 16:32:46 +0200
committerGreg Kurz <groug@kaod.org>2017-09-05 14:01:16 +0200
commit403a905b03d48187df1e1392bfa3e303eeefe892 (patch)
tree080d61b54cab87d7b2c930ac666ba11f6a99cc82 /hw/9pfs
parent53e2c48d3f0db6a1598f49baf0b56dd4975e53a7 (diff)
9pfs: avoid sign conversion error simplifying the code
(note this is how other functions also handle the errors). hw/9pfs/9p.c:948:18: warning: Loss of sign in implicit conversion offset = err; ^~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Greg Kurz <groug@kaod.org>
Diffstat (limited to 'hw/9pfs')
-rw-r--r--hw/9pfs/9p.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 333dbb6f8e..0a37c8bd13 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -945,7 +945,6 @@ static void coroutine_fn v9fs_version(void *opaque)
v9fs_string_init(&version);
err = pdu_unmarshal(pdu, offset, "ds", &s->msize, &version);
if (err < 0) {
- offset = err;
goto out;
}
trace_v9fs_version(pdu->tag, pdu->id, s->msize, version.data);
@@ -962,13 +961,12 @@ static void coroutine_fn v9fs_version(void *opaque)
err = pdu_marshal(pdu, offset, "ds", s->msize, &version);
if (err < 0) {
- offset = err;
goto out;
}
- offset += err;
+ err += offset;
trace_v9fs_version_return(pdu->tag, pdu->id, s->msize, version.data);
out:
- pdu_complete(pdu, offset);
+ pdu_complete(pdu, err);
v9fs_string_free(&version);
}