lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 13 Nov 2018 06:39:07 +0000
From:   Yogesh Narayan Gaur <yogeshnarayan.gaur@....com>
To:     Huijin Park <huijin.park@...sung.com>,
        Boris Brezillon <boris.brezillon@...tlin.com>
CC:     Marek Vasut <marek.vasut@...il.com>,
        "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "bbanghj.park@...il.com" <bbanghj.park@...il.com>
Subject: RE: [PATCH] mtd: spi-nor: cast to u64 to avoid uint overflows

Hi Huijin,

I guess this is the v2 of previously send patch [1], please follow version information in patch submission.

--
Regards
Yogesh Gaur
[1] https://patchwork.ozlabs.org/patch/961197/


> -----Original Message-----
> From: linux-mtd [mailto:linux-mtd-bounces@...ts.infradead.org] On Behalf Of
> Huijin Park
> Sent: Tuesday, November 13, 2018 10:49 AM
> To: Boris Brezillon <boris.brezillon@...tlin.com>
> Cc: Marek Vasut <marek.vasut@...il.com>; linux-mtd@...ts.infradead.org;
> linux-kernel@...r.kernel.org; bbanghj.park@...il.com; Huijin Park
> <huijin.park@...sung.com>
> Subject: [PATCH] mtd: spi-nor: cast to u64 to avoid uint overflows
> 
> From: "huijin.park" <huijin.park@...sung.com>
> 
> 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" and "info->n_sectors" to an u64.
> 
> Signed-off-by: huijin.park <huijin.park@...sung.com>
> ---
>  drivers/mtd/spi-nor/spi-nor.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index
> d9c368c..527f281 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -2459,7 +2459,7 @@ static int spi_nor_init_params(struct spi_nor *nor,
>  	memset(params, 0, sizeof(*params));
> 
>  	/* Set SPI NOR sizes. */
> -	params->size = info->sector_size * info->n_sectors;
> +	params->size = (u64)info->sector_size * (u64)info->n_sectors;
>  	params->page_size = info->page_size;
> 
>  	/* (Fast) Read settings. */
> --
> 1.7.9.5
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.infr
> adead.org%2Fmailman%2Flistinfo%2Flinux-
> mtd%2F&amp;data=02%7C01%7Cyogeshnarayan.gaur%40nxp.com%7C5efd964
> 86c7244f430b408d649278b65%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%
> 7C1%7C636776831529836639&amp;sdata=A7hiJMpfxXKTyT6yacIougPRGdHg2o
> pL492y3sVtQek%3D&amp;reserved=0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ