qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PULL 11/17] iov: avoid "orig_len may be used unitialized


From: Michael Tokarev
Subject: [Qemu-trivial] [PULL 11/17] iov: avoid "orig_len may be used unitialized" warning
Date: Fri, 20 Sep 2013 20:58:10 +0400

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
 util/iov.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/util/iov.c b/util/iov.c
index f705586..bb46c04 100644
--- a/util/iov.c
+++ b/util/iov.c
@@ -181,13 +181,11 @@ ssize_t iov_send_recv(int sockfd, struct iovec *iov, 
unsigned iov_cnt,
             assert(iov[niov].iov_len > tail);
             orig_len = iov[niov].iov_len;
             iov[niov++].iov_len = tail;
-        }
-
-        ret = do_send_recv(sockfd, iov, niov, do_send);
-
-        /* Undo the changes above before checking for errors */
-        if (tail) {
+            ret = do_send_recv(sockfd, iov, niov, do_send);
+            /* Undo the changes above before checking for errors */
             iov[niov-1].iov_len = orig_len;
+        } else {
+            ret = do_send_recv(sockfd, iov, niov, do_send);
         }
         if (offset) {
             iov[0].iov_base -= offset;
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]