peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0040-iov-avoid-orig_len-may-be-used-unitialized-warning.patch

298366
From b314120afdbab3d29885f47fc83bc55f43765968 Mon Sep 17 00:00:00 2001
298366
From: Michael Tokarev <mjt@tls.msk.ru>
298366
Date: Sat, 14 Sep 2013 13:11:36 +0400
298366
Subject: [PATCH] iov: avoid "orig_len may be used unitialized" warning
298366
298366
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
298366
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
298366
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
298366
(cherry picked from commit 2be178a475289286db80de5ddd7830e67e112bdd)
298366
298366
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
298366
---
298366
 util/iov.c | 10 ++++------
298366
 1 file changed, 4 insertions(+), 6 deletions(-)
298366
298366
diff --git a/util/iov.c b/util/iov.c
298366
index f705586..bb46c04 100644
298366
--- a/util/iov.c
298366
+++ b/util/iov.c
298366
@@ -181,13 +181,11 @@ ssize_t iov_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt,
298366
             assert(iov[niov].iov_len > tail);
298366
             orig_len = iov[niov].iov_len;
298366
             iov[niov++].iov_len = tail;
298366
-        }
298366
-
298366
-        ret = do_send_recv(sockfd, iov, niov, do_send);
298366
-
298366
-        /* Undo the changes above before checking for errors */
298366
-        if (tail) {
298366
+            ret = do_send_recv(sockfd, iov, niov, do_send);
298366
+            /* Undo the changes above before checking for errors */
298366
             iov[niov-1].iov_len = orig_len;
298366
+        } else {
298366
+            ret = do_send_recv(sockfd, iov, niov, do_send);
298366
         }
298366
         if (offset) {
298366
             iov[0].iov_base -= offset;