qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Samuel Thibault <samuel.thibault@gnu.org>
Cc: qemu-devel@nongnu.org, jan.kiszka@siemens.com
Subject: Re: [Qemu-devel] [PATCH] slirp: Gcc 9 -O3 fix
Date: Fri, 12 Apr 2019 16:49:42 +0100	[thread overview]
Message-ID: <20190412154942.GF2906@work-vm> (raw)
In-Reply-To: <20190411184502.xvesnriqcocyvuan@function>

* Samuel Thibault (samuel.thibault@gnu.org) wrote:
> 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?

Adding the assert in soread sorts that case out:
  assert(sopreprbuf(so, iov, &n) != 0);

however, I also need to fix soreadbuf;  is it legal to call that with
a 0 size?

Dave

> Samuel
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

WARNING: multiple messages have this Message-ID (diff)
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Samuel Thibault <samuel.thibault@gnu.org>
Cc: jan.kiszka@siemens.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] slirp: Gcc 9 -O3 fix
Date: Fri, 12 Apr 2019 16:49:42 +0100	[thread overview]
Message-ID: <20190412154942.GF2906@work-vm> (raw)
Message-ID: <20190412154942.AF2x80xzF83hV3XPImKna62iiBJElKoC_9TmHelqib4@z> (raw)
In-Reply-To: <20190411184502.xvesnriqcocyvuan@function>

* Samuel Thibault (samuel.thibault@gnu.org) wrote:
> 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?

Adding the assert in soread sorts that case out:
  assert(sopreprbuf(so, iov, &n) != 0);

however, I also need to fix soreadbuf;  is it legal to call that with
a 0 size?

Dave

> Samuel
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


  parent reply	other threads:[~2019-04-12 15:49 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
2019-04-11 18:45       ` Samuel Thibault
2019-04-12 15:49       ` Dr. David Alan Gilbert [this message]
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=20190412154942.GF2906@work-vm \
    --to=dgilbert@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    --cc=samuel.thibault@gnu.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).