[Qemu-devel] [PATCH v3] slirp: Gcc 9 -O3 fix

Dr. David Alan Gilbert (git) posted 1 patch 5 years ago
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test checkpatch failed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190415121740.9881-1-dgilbert@redhat.com
Maintainers: Samuel Thibault <samuel.thibault@ens-lyon.org>, Jan Kiszka <jan.kiszka@siemens.com>
slirp/src/socket.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[Qemu-devel] [PATCH v3] slirp: Gcc 9 -O3 fix
Posted by Dr. David Alan Gilbert (git) 5 years ago
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.

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

diff --git a/slirp/src/socket.c b/slirp/src/socket.c
index 4a3c935e25..bb752fdcae 100644
--- a/slirp/src/socket.c
+++ b/slirp/src/socket.c
@@ -171,6 +171,7 @@ int
 soread(struct socket *so)
 {
 	int n, nn;
+	size_t buf_len;
 	struct sbuf *sb = &so->so_snd;
 	struct iovec iov[2];
 
@@ -181,7 +182,8 @@ soread(struct socket *so)
 	 * No need to check if there's enough room to read.
 	 * soread wouldn't have been called if there weren't
 	 */
-	sopreprbuf(so, iov, &n);
+	buf_len = sopreprbuf(so, iov, &n);
+	assert(buf_len != 0);
 
 	nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
 	if (nn <= 0) {
@@ -257,6 +259,7 @@ int soreadbuf(struct socket *so, const char *buf, int size)
 	 * No need to check if there's enough room to read.
 	 * soread wouldn't have been called if there weren't
 	 */
+	assert(size > 0);
 	if (sopreprbuf(so, iov, &n) < size)
         goto err;
 
-- 
2.21.0


Re: [Qemu-devel] [PATCH v3] slirp: Gcc 9 -O3 fix
Posted by Samuel Thibault 5 years ago
Dr. David Alan Gilbert (git), le lun. 15 avril 2019 13:17:40 +0100, a ecrit:
> 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.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Applied to my tree, thanks!

Samuel

Re: [Qemu-devel] [PATCH v3] slirp: Gcc 9 -O3 fix
Posted by no-reply@patchew.org 5 years ago
Patchew URL: https://patchew.org/QEMU/20190415121740.9881-1-dgilbert@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190415121740.9881-1-dgilbert@redhat.com
Subject: [Qemu-devel] [PATCH v3] slirp: Gcc 9 -O3 fix
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20190415121740.9881-1-dgilbert@redhat.com -> patchew/20190415121740.9881-1-dgilbert@redhat.com
Switched to a new branch 'test'
dd67fbaa40 slirp: Gcc 9 -O3 fix

=== OUTPUT BEGIN ===
ERROR: code indent should never use tabs
#22: FILE: slirp/src/socket.c:174:
+^Isize_t buf_len;$

ERROR: code indent should never use tabs
#31: FILE: slirp/src/socket.c:185:
+^Ibuf_len = sopreprbuf(so, iov, &n);$

ERROR: code indent should never use tabs
#32: FILE: slirp/src/socket.c:186:
+^Iassert(buf_len != 0);$

ERROR: code indent should never use tabs
#40: FILE: slirp/src/socket.c:262:
+^Iassert(size > 0);$

total: 4 errors, 0 warnings, 23 lines checked

Commit dd67fbaa4003 (slirp: Gcc 9 -O3 fix) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190415121740.9881-1-dgilbert@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com