qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] 9pfs: fix v9fs_lock error case
@ 2017-01-26 10:07 Paolo Bonzini
  2017-01-26 11:54 ` Greg Kurz
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2017-01-26 10:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: groug, aneesh.kumar

In this case, we are marshaling an error status instead of the errno value.
Reorganize the out and out_nofid labels to look like all the other cases.
Coverity reports this because the "err = -ENOENT" and "err = -EINVAL"
assignments above are dead, overwritten by the call to pdu_marshal.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/9pfs/9p.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 99e9472..d028eca 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -3045,14 +3045,15 @@ static void coroutine_fn v9fs_lock(void *opaque)
         goto out;
     }
     status = P9_LOCK_SUCCESS;
-out:
-    put_fid(pdu, fidp);
-out_nofid:
     err = pdu_marshal(pdu, offset, "b", status);
-    if (err > 0) {
-        err += offset;
+    if (err < 0) {
+        goto out;
     }
+    err += offset;
     trace_v9fs_lock_return(pdu->tag, pdu->id, status);
+out:
+    put_fid(pdu, fidp);
+out_nofid:
     pdu_complete(pdu, err);
     v9fs_string_free(&flock.client_id);
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-26 11:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-26 10:07 [Qemu-devel] [PATCH] 9pfs: fix v9fs_lock error case Paolo Bonzini
2017-01-26 11:54 ` Greg Kurz
2017-01-26 11:58   ` Paolo Bonzini

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).