Fix silent truncations in the SPI NOR driver
Subsystems (2)
v2 cover Fix silent truncations in the SPI NOR driver
Hello!
Here's a set of 2 patches against the 'mtd/fixes' branch of the MTD 'linux.git' repo. The SPI NOR driver assigns th result of a function returning 'ssize_t' to the *int* variable in a couple of places, while 'ssize_t' is a 64-bit type and *int* is a 32-bit type on the 64-bit machines. The silent truncation that happens there isn't really valid, so we have to fix up the variable's type...
[1/2] mtd: spi-nor: fix silent truncation in spi_nor_read() [2/2] mtd: spi-nor: fix silent truncation in spi_nor_read_raw()
MBR, Sergei
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH v2 1/2 mtd: spi-nor: fix silent truncation in spi_nor_read()
spi_nor_read() assigns the result of 'ssize_t spi_nor_read_data()' to the 'int ret' variable, while 'ssize_t' is a 64-bit type and *int* is a 32-bit type on the 64-bit machines. This silent truncation isn't really valid, so fix up the variable's type.
---
Changes in version 2:
- cleaned up the patch description.
drivers/mtd/spi-nor/spi-nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/spi-nor.c +1 -1
@@ -2544,7 +2544,7 @@ static int spi_nor_read(struct mtd_info size_t *retlen, u_char *buf) { struct spi_nor *nor = mtd_to_spi_nor(mtd); -int ret; +ssize_t ret;dev_dbg (nor->dev,"from 0x%08x, len %zd\n" , (u32 )from, len);
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH v2 2/2 mtd: spi-nor: fix silent truncation in spi_nor_read_raw()
In reply to Sergei Shtylyovspi_nor_read_raw() assigns the result of 'ssize_t spi_nor_read_data()' to the 'int ret' variable, while 'ssize_t' is a 64-bit type and *int* is a 32-bit type on the 64-bit machines. This silent truncation isn't really valid, so fix up the variable's type.
---
Changes in version 2:
- new patch.
drivers/mtd/spi-nor/spi-nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/spi-nor.c +1 -1
@@ -2865,7 +2865,7 @@ static int spi_nor_hwcaps_pp2cmd(u32 hwc*/ static int spi_nor_read_raw (struct spi_nor *nor,u32 addr,size_t len,u8 *buf) { -int ret; +ssize_t ret;while (len) { ret =spi_nor_read_data (nor, addr, len, buf);
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 5 lines · Sergei Shtylyov
External E-Mail
Hello!
Quoted 9 lines
Here's a set of 2 patches against the 'mtd/fixes' branch of the MTD 'linux.git' repo. The SPI NOR driver assigns th result of a function returning '
ssize_t' to the *int* variable in a couple of places, while 'ssize_t' is a 64-bit type and *int* is a 32-bit type on the 64-bit machines. The silent truncation that happens there isn't really valid, so we have to fix up the variable's type...[1/2] mtd: spi-nor: fix silent truncation in
spi_nor_read()[2/2] mtd: spi-nor: fix silent truncation inspi_nor_read_raw()
Both applied to spi-nor/next. Thanks.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/