All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] slirp: Gcc 9 -O3 fix
@ 2019-04-05 18:46 Dr. David Alan Gilbert (git)
  2019-04-05 19:08   ` no-reply
  2019-04-05 21:25   ` Samuel Thibault
  0 siblings, 2 replies; 15+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-04-05 18:46 UTC (permalink / raw)
  To: qemu-devel, samuel.thibault, jan.kiszka

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Gcc 9 needs some convincing that sopreprbuf really is going to fill
in iov in the call from soreadbuf, even though the failure case
shouldn't happen; so swing the check around initialising the fields.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 slirp/src/socket.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/slirp/src/socket.c b/slirp/src/socket.c
index 4a3c935e25..4a2222a95f 100644
--- a/slirp/src/socket.c
+++ b/slirp/src/socket.c
@@ -113,12 +113,14 @@ size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np)
 	DEBUG_CALL("sopreprbuf");
 	DEBUG_ARG("so = %p", so);
 
-	if (len <= 0)
-		return 0;
-
 	iov[0].iov_base = sb->sb_wptr;
+        iov[0].iov_len = 0;
         iov[1].iov_base = NULL;
         iov[1].iov_len = 0;
+
+	if (len <= 0)
+		return 0;
+
 	if (sb->sb_wptr < sb->sb_rptr) {
 		iov[0].iov_len = sb->sb_rptr - sb->sb_wptr;
 		/* Should never succeed, but... */
-- 
2.21.0

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

end of thread, other threads:[~2019-04-15 12:04 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-05 18:46 [Qemu-devel] [PATCH] slirp: Gcc 9 -O3 fix Dr. David Alan Gilbert (git)
2019-04-05 19:08 ` no-reply
2019-04-05 19:08   ` no-reply
2019-04-05 21:25 ` Samuel Thibault
2019-04-05 21:25   ` Samuel Thibault
2019-04-08  8:46   ` Dr. David Alan Gilbert
2019-04-08  8:46     ` Dr. David Alan Gilbert
2019-04-11 18:45     ` Samuel Thibault
2019-04-11 18:45       ` Samuel Thibault
2019-04-12 15:49       ` Dr. David Alan Gilbert
2019-04-12 15:49         ` Dr. David Alan Gilbert
2019-04-12 21:16         ` Samuel Thibault
2019-04-12 21:16           ` Samuel Thibault
2019-04-15 12:02           ` Dr. David Alan Gilbert
2019-04-15 12:02             ` Dr. David Alan Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.