From: Dave Chinner <david@fromorbit.com>
To: "Arkadiusz Miśkiewicz" <arekm@maven.pl>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] Detect strto* failures based on errno.
Date: Thu, 17 Jul 2014 09:32:49 +1000 [thread overview]
Message-ID: <20140716233249.GG4453@dastard> (raw)
In-Reply-To: <201407160944.07266.arekm@maven.pl>
On Wed, Jul 16, 2014 at 09:44:07AM +0200, Arkadiusz Miśkiewicz wrote:
> On Wednesday 16 of July 2014, Dave Chinner wrote:
> > On Mon, Jul 14, 2014 at 09:56:59AM +0200, Arkadiusz Miśkiewicz wrote:
> > > Code was testing for ERANGE errno only in some places. In other places
> > > it didn't do any errno checking at all.
> > >
> > > Unify strto* result testing by treating any non zero errno as failure.
> > >
> > > Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
> >
> > This patch appears to cause xfs/071 to fail:
> >
> >
> >
> > Writing 512 bytes, offset is +0 (direct=false)
> > -pwrite64: File too large
> > +non-numeric offset argument -- <OFFSET>
> > Reading 512 bytes (direct=false)
> > read 0/512 bytes at offset <OFFSET>
> > ...
> > (Run 'diff -u tests/xfs/071.out
> > /home/dave/src/xfstests-dev/results//xfs/071.out.bad' to see the entire
> > diff)
> >
> > Can you have a look into this?
>
> The test runs:
> xfs_io -c 'pwrite 9223373136366403583 512' file
>
> where 9223373136366403583 is bigger than LLONG_MAX (9223372036854775807), so
>
> # LC_ALL=C xfs_io -c 'pwrite 9223373136366403583 512' ./x
> (MYDEBUG)strerror(34): Numerical result out of range
> non-numeric offset argument -- 9223373136366403583
>
>
> What would be best approach to fix this - some cvtunum for unsigned long long?
I'm pretty sure that cvtnum is only supposed to work with positive
integers - it returns negative values as an error. hence just
changing to use strtoull() would probably fix the issue.
The caller can determine if a negative number is valid or not....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2014-07-16 23:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-11 19:34 [PATCH] Catch under/overflow cases in cvtnum() and cvttime() Arkadiusz Miśkiewicz
2014-07-11 23:14 ` Eric Sandeen
2014-07-12 6:13 ` Arkadiusz Miśkiewicz
2014-07-12 13:37 ` Eric Sandeen
2014-07-12 13:43 ` Eric Sandeen
2014-07-13 17:38 ` [PATCH] Init errno before strto* calls Arkadiusz Miśkiewicz
2014-07-13 23:04 ` Dave Chinner
2014-07-14 7:56 ` [PATCH] Detect strto* failures based on errno Arkadiusz Miśkiewicz
2014-07-16 0:00 ` Dave Chinner
2014-07-16 3:01 ` Dave Chinner
2014-07-16 7:44 ` Arkadiusz Miśkiewicz
2014-07-16 23:32 ` Dave Chinner [this message]
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=20140716233249.GG4453@dastard \
--to=david@fromorbit.com \
--cc=arekm@maven.pl \
--cc=xfs@oss.sgi.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