All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Greg Kurz <groug@kaod.org>
Cc: Eric Blake <eblake@redhat.com>, Nia Alarie <nia.alarie@gmail.com>,
	qemu-devel@nongnu.org, stefanha@gmail.com, jim@groklearning.com,
	joel@jms.id.au
Subject: Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking
Date: Mon, 12 Mar 2018 13:08:29 +0000	[thread overview]
Message-ID: <20180312130829.GR3493@redhat.com> (raw)
In-Reply-To: <20180312140229.66930d5d@bahia.lan>

On Mon, Mar 12, 2018 at 02:02:29PM +0100, Greg Kurz wrote:
> On Mon, 12 Mar 2018 07:12:52 -0500
> Eric Blake <eblake@redhat.com> wrote:
> 
> > On 03/11/2018 03:12 PM, Nia Alarie wrote:
> > > Signed-off-by: Nia Alarie <nia.alarie@gmail.com>
> > > ---
> > >   hw/9pfs/9p.c | 12 ++++++++++--
> > >   1 file changed, 10 insertions(+), 2 deletions(-)
> > >   
> > 
> > >       } else if (perm & P9_STAT_MODE_LINK) {
> > > -        int32_t ofid = atoi(extension.data);
> > > -        V9fsFidState *ofidp = get_fid(pdu, ofid);
> > > +        long ofid;
> > > +        V9fsFidState *ofidp;
> > > +
> > > +        if (qemu_strtol(extension.data, NULL, 10, &ofid) ||
> > > +            ofid > INT32_MAX || ofid < INT32_MIN) {  
> > 
> > Dan has a pending patch that will add qemu_strtoi, which might be a 
> > nicer fit for this situation:
> > 
> > https://lists.gnu.org/archive/html/qemu-devel/2018-02/msg00952.html
> > 
> > int32_t is not necessarily int, but all platforms that compile qemu have 
> > 'int32_t' and 'int' both at 32 bits, so it's simpler to change to 'int 
> > ofid' and use Dan's function than it is to parse to long and then do 
> > bounds checking.  Except that Dan still needs to post an updated version 
> > of his patch...
> > 
> 
> I wasn't aware of Dan's patch but I agree it would result in a nicer
> change for 9p. This being said, tomorrow is soft freeze... is there
> a chance Dan's patch reaches master anytime soon ?

I just sent an update of my series. If it gets acked by Eric, I'd be able
to send a pull request today.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

  reply	other threads:[~2018-03-12 13:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-11 20:12 [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking Nia Alarie
2018-03-12  9:01 ` Greg Kurz
2018-03-12 13:16   ` Greg Kurz
2018-03-12 12:12 ` Eric Blake
2018-03-12 13:02   ` Greg Kurz
2018-03-12 13:08     ` Daniel P. Berrangé [this message]
2018-03-12 13:21       ` Greg Kurz
2018-03-13 15:25         ` nee
2018-03-13 15:52           ` Stefan Hajnoczi
2018-03-13 16:28             ` Greg Kurz

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=20180312130829.GR3493@redhat.com \
    --to=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=groug@kaod.org \
    --cc=jim@groklearning.com \
    --cc=joel@jms.id.au \
    --cc=nia.alarie@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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.