Re: [PATCH 01/52] kstrtox: converting strings to integers done(hopefully) right

From: Alexey Dobriyan
Date: Sat Feb 05 2011 - 09:40:19 EST


On Sat, Feb 05, 2011 at 03:33:41PM +0100, Geert Uytterhoeven wrote:
> On Sat, Feb 5, 2011 at 15:20, Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:

> > + * Convert integer string representation to an integer.
> > + * If an integer doesn't fit into specified type, -E is returned.
>
> Which -E? Currently it returns -EINVAL everywhere.

Comment meant function follows 0/-E idiom for return value.

> > +       if (tmp != (unsigned long long)(unsigned long)tmp)
> > +               return -EINVAL;
>
> -ERANGE for out-of-range?

Hmm, interesting.
It should prevent -EINVAL hardcoding.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/