All of lore.kernel.org
 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: Mon, 15 Apr 2019 13:02:36 +0100	[thread overview]
Message-ID: <20190415120236.GJ2852@work-vm> (raw)
In-Reply-To: <20190412211633.6pyn6cfm5dnwjzji@function>

* Samuel Thibault (samuel.thibault@gnu.org) wrote:
> Dr. David Alan Gilbert, le ven. 12 avril 2019 16:49:42 +0100, a ecrit:
> > * 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?
> 
> It does not really make sense to, so an assert >0 should be fine.

OK, replacement patch with just a couple of asserts sent.

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: Mon, 15 Apr 2019 13:02:36 +0100	[thread overview]
Message-ID: <20190415120236.GJ2852@work-vm> (raw)
Message-ID: <20190415120236.DbmK6xtV9FKYzGpsQ95lIjPOcYw6ZFFDwNlkdsaNgow@z> (raw)
In-Reply-To: <20190412211633.6pyn6cfm5dnwjzji@function>

* Samuel Thibault (samuel.thibault@gnu.org) wrote:
> Dr. David Alan Gilbert, le ven. 12 avril 2019 16:49:42 +0100, a ecrit:
> > * 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?
> 
> It does not really make sense to, so an assert >0 should be fine.

OK, replacement patch with just a couple of asserts sent.

Dave

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


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

Thread overview: 15+ 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 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 [this message]
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=20190415120236.GJ2852@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 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.