Re: [PATCH 04/19] mkfs: validate all input values

Jan Tulak
2016-04-07T11:16:13Z

[-- Attachment #1.1: Type: text/plain, Size: 1667 bytes --]

On Thu, Apr 7, 2016 at 1:02 AM, Eric Sandeen <sandeen@sandeen.net> wrote:

> On 3/24/16 6:15 AM, jtulak@redhat.com wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > CHANGELOG
> > o Fix an unsigned < 0 comparison - save getnum result to another variable
> > and test it, before converting it to unsigned logagno.
>
> ...
>
> > @@ -1468,7 +1485,10 @@ main(
> > respec('l', lopts,
> L_AGNUM);
> > if (ldflag)
> > conflict('l', lopts,
> L_AGNUM, L_DEV);
> > - logagno = atoi(value);
> > + tmp_num = getnum(value, 0, 0,
> false);
> > + if (tmp_num < 0)
> > + illegal(value, "l agno");
> > + logagno = (xfs_agnumber_t)tmp_num;
> > laflag = 1;
> > break;
> > case L_FILE:
>
> Why not cast to (__int64_t) like other variables do? i.e.
>
>
> + logagno = getnum(value, 0, 0,
> false);
> + if ((__int64_t)logagno < 0)
> + illegal(value, "l agno");
>
> or am I missing something?
>
> Nothing I'm aware of. Replaced.

> Thanks,
> -Eric
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
>

--
Jan Tulak
jtulak@redhat.com / jan@tulak.me

[-- Attachment #1.2: Type: text/html, Size: 3488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]