From: Samuel Thibault <samuel.thibault@gnu.org>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, jan.kiszka@siemens.com
Subject: Re: [Qemu-devel] [PATCH] slirp: Gcc 9 -O3 fix
Date: Thu, 11 Apr 2019 20:45:02 +0200	[thread overview]
Message-ID: <20190411184502.xvesnriqcocyvuan@function> (raw)
In-Reply-To: <20190408084653.GB2687@work-vm>
Hello,
Dr. David Alan Gilbert, le lun. 08 avril 2019 09:46:53 +0100, a ecrit:
> 'soread' has the comment:
> 
>         /*
>          * 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);
> 
> the compiler doesn't realise that, and is moaning about the case
> where the if (len <=0) return happens and the following 
> code tries to use iov.
I see. Perhaps we should make this an assert then? In case this isn't
true, i.e. soread() is called even if no room is available, returning 0
would probably just let the caller just try again, and we should rather
just plainly crash than hang?
Samuel
WARNING: multiple messages have this Message-ID (diff)
From: Samuel Thibault <samuel.thibault@gnu.org>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: jan.kiszka@siemens.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] slirp: Gcc 9 -O3 fix
Date: Thu, 11 Apr 2019 20:45:02 +0200	[thread overview]
Message-ID: <20190411184502.xvesnriqcocyvuan@function> (raw)
Message-ID: <20190411184502.YA40qla51cZ5T67N4APaevfoAUsTgBpuzjL760yFlrY@z> (raw)
In-Reply-To: <20190408084653.GB2687@work-vm>
Hello,
Dr. David Alan Gilbert, le lun. 08 avril 2019 09:46:53 +0100, a ecrit:
> 'soread' has the comment:
> 
>         /*
>          * 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);
> 
> the compiler doesn't realise that, and is moaning about the case
> where the if (len <=0) return happens and the following 
> code tries to use iov.
I see. Perhaps we should make this an assert then? In case this isn't
true, i.e. soread() is called even if no room is available, returning 0
would probably just let the caller just try again, and we should rather
just plainly crash than hang?
Samuel
next prev parent reply	other threads:[~2019-04-11 18:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 18:46 [Qemu-devel] [PATCH] slirp: Gcc 9 -O3 fix Dr. David Alan Gilbert (git)
2019-04-05 18:46 ` 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 [this message]
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
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=20190411184502.xvesnriqcocyvuan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).