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

Jan Tulak jtulak at redhat.com
Thu Apr 7 06:15:51 CDT 2016


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

> On 3/24/16 6:15 AM, jtulak at redhat.com wrote:
> > From: Dave Chinner <dchinner at 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 at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
>



-- 
Jan Tulak
jtulak at redhat.com / jan at tulak.me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://oss.sgi.com/pipermail/xfs/attachments/20160407/078861ed/attachment.html>


More information about the xfs mailing list