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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <1535009282-1480-1-git-send-email-huijin.park@samsung.com>
Date:   Thu, 23 Aug 2018 03:28:02 -0400
From:   Huijin Park <huijin.park@...sung.com>
To:     Marek Vasut <marek.vasut@...il.com>
Cc:     Boris Brezillon <boris.brezillon@...tlin.com>,
        Huijin Park <huijin.park@...sung.com>, bbanghj.park@...il.com,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] mtd: cast to u64 to avoid unexpected error

From: "huijin.park" <huijin.park@...sung.com>

the params->size is defined as "u64"
and, "info->sector_size" and "info->n_sectors" is defined as unsgined and u16
thus, u64 data might have strange data(loss data) if data is overflow.
this patch cast it to 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ