[PATCH 06/10] mtd-utils: nandwrite: Use 64-bit offset

Mike Frysinger vapier.adi at gmail.com
Sat Nov 13 17:45:51 EST 2010


On Sat, Nov 13, 2010 at 06:48, Artem Bityutskiy wrote:
> On Wed, 2010-11-03 at 01:27 -0700, Brian Norris wrote:
>> -                             mtdoffset = strtol(optarg, NULL, 0);
>> +                             mtdoffset = strtoll(optarg, NULL, 0);
>
> Ideally this should check for strtoll failures, but this just a side
> note. Not sure if this is the best way, but I'd do it like this:
>
> char *endp;
>
> mtdoffset = strtoul(optarg, &endp, 0);
> if (*endp != '\0' || endp == optarg)
>        return errmsg("bad volume alignment: \"%s\"", optarg);
>
> or something like this. The check for negative mtdoffset could be there
> as well.

or use simple_strtoll() from common.h as that includes error handling ...
-mike



More information about the linux-mtd mailing list