Re: [PATCH v3] mtd: spi-nor: cast to u64 to avoid uint overflows

From: Geert Uytterhoeven
Date: Wed Nov 28 2018 - 03:41:23 EST


On Wed, Nov 28, 2018 at 9:03 AM Huijin Park <huijin.park@xxxxxxxxxxx> wrote:
> From: "huijin.park" <huijin.park@xxxxxxxxxxx>
>
> The "params->size" is defined as "u64".
> And "info->sector_size" and "info->n_sectors" are defined as
> unsigned int and u16.
> Thus, u64 data might have strange data(loss data) if the result
> overflows an unsigned int.
> This patch casts "info->sector_size" to an u64.
>
> Signed-off-by: huijin.park <huijin.park@xxxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds