[PATCH v4] mtd-utils: Add mtdpart to add/delete partition

Mike Frysinger vapier at chromium.org
Mon Apr 27 02:15:45 PDT 2015


On Wed, Apr 15, 2015 at 2:18 AM, <namnguyen at chromium.org> wrote:
> +static int                     part_no;                /* partition number */

it's an int ...

> +       if (strcmp(s_command, "del") == 0 && (argc - optind) == 1) {
> +               const char *s_part_no = argv[optind++];
> +
> +               part_no = simple_strtol(s_part_no, &error);

... but here you use simple_strol.  so there's a possibility of silent
truncation ?  i'd change part_no to a long and then check to see if it
exceeds INT_MAX.
-mike



More information about the linux-mtd mailing list