OSDN Git Service

mtd: spi-nor: cast to u64 to avoid uint overflows
authorhuijin.park <huijin.park@samsung.com>
Wed, 28 Nov 2018 08:02:14 +0000 (03:02 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 08:21:33 +0000 (09:21 +0100)
commit37b5fff3d666fae1df038d8f9e90586e5e0e8ba1
tree79a3b5ab75faf859f3343ec7b5236db2ef7677f8
parent4535def71226e3d7f330875f1746b479baaf6bc6
mtd: spi-nor: cast to u64 to avoid uint overflows

commit 84a1c2109d23df3543d96231c4fee1757299bb1a upstream.

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@samsung.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/spi-nor/spi-nor.c