qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Eric Blake <eblake@redhat.com>
Cc: Nia Alarie <nia.alarie@gmail.com>,
	qemu-devel@nongnu.org, stefanha@gmail.com, jim@groklearning.com,
	joel@jms.id.au, "Daniel P. Berrange" <berrange@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking
Date: Mon, 12 Mar 2018 14:02:29 +0100	[thread overview]
Message-ID: <20180312140229.66930d5d@bahia.lan> (raw)
In-Reply-To: <486e1b60-e453-c3de-040b-8b2951ddf3a5@redhat.com>

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 ?

  reply	other threads:[~2018-03-12 13:06 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 [this message]
2018-03-12 13:08     ` Daniel P. Berrangé
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=20180312140229.66930d5d@bahia.lan \
    --to=groug@kaod.org \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --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 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).