All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, jan.kiszka@siemens.com
Subject: Re: [Qemu-devel] [PATCH v2] slirp: Gcc 9 -O3 fix
Date: Mon, 15 Apr 2019 14:03:28 +0200	[thread overview]
Message-ID: <20190415120328.bcuxvj6nrjh7b4ol@function> (raw)
In-Reply-To: <20190415120205.2221-1-dgilbert@redhat.com>

Dr. David Alan Gilbert (git), le lun. 15 avril 2019 13:02:05 +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>
> ---
>  slirp/src/socket.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/slirp/src/socket.c b/slirp/src/socket.c
> index 4a3c935e25..beb8517f1c 100644
> --- a/slirp/src/socket.c
> +++ b/slirp/src/socket.c
> @@ -181,7 +181,7 @@ 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);
> +	assert(sopreprbuf(so, iov, &n) != 0);

Please make this through a variable, otherwise anybody building with
-DNDEBUG will get sopreprbuf not being called.

>  	nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
>  	if (nn <= 0) {
> @@ -257,6 +257,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
> 

WARNING: multiple messages have this Message-ID (diff)
From: Samuel Thibault <samuel.thibault@gnu.org>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: jan.kiszka@siemens.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] slirp: Gcc 9 -O3 fix
Date: Mon, 15 Apr 2019 14:03:28 +0200	[thread overview]
Message-ID: <20190415120328.bcuxvj6nrjh7b4ol@function> (raw)
Message-ID: <20190415120328.NC_weTdM8AwJnw4kfh3Uejd44CaNUq4I2ysjuvIFpeM@z> (raw)
In-Reply-To: <20190415120205.2221-1-dgilbert@redhat.com>

Dr. David Alan Gilbert (git), le lun. 15 avril 2019 13:02:05 +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>
> ---
>  slirp/src/socket.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/slirp/src/socket.c b/slirp/src/socket.c
> index 4a3c935e25..beb8517f1c 100644
> --- a/slirp/src/socket.c
> +++ b/slirp/src/socket.c
> @@ -181,7 +181,7 @@ 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);
> +	assert(sopreprbuf(so, iov, &n) != 0);

Please make this through a variable, otherwise anybody building with
-DNDEBUG will get sopreprbuf not being called.

>  	nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
>  	if (nn <= 0) {
> @@ -257,6 +257,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
> 


  reply	other threads:[~2019-04-15 12:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 12:02 [Qemu-devel] [PATCH v2] slirp: Gcc 9 -O3 fix Dr. David Alan Gilbert (git)
2019-04-15 12:03 ` Samuel Thibault [this message]
2019-04-15 12:03   ` Samuel Thibault
2019-04-15 12:15   ` Dr. David Alan Gilbert
2019-04-15 12:15     ` Dr. David Alan Gilbert
2019-04-15 12:07 ` no-reply
2019-04-15 12:07   ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190415120328.bcuxvj6nrjh7b4ol@function \
    --to=samuel.thibault@gnu.org \
    --cc=dgilbert@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.