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

Artem Bityutskiy dedekind1 at gmail.com
Sat Nov 13 06:48:39 EST 2010


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.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list