All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fix silent truncations in the SPI NOR driver
@ 2019-10-30 18:44 Sergei Shtylyov
  2019-10-30 18:48 ` [PATCH v2 1/2] mtd: spi-nor: fix silent truncation in spi_nor_read() Sergei Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2019-10-30 18:44 UTC (permalink / raw)
  To: Marek Vasut, Tudor Ambarus, David Woodhouse, Brian Norris,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	linux-mtd

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] mtd: spi-nor: fix silent truncation in spi_nor_read()
  2019-10-30 18:44 [PATCH v2 0/2] Fix silent truncations in the SPI NOR driver Sergei Shtylyov
@ 2019-10-30 18:48 ` Sergei Shtylyov
  2019-10-30 18:53 ` [PATCH v2 2/2] mtd: spi-nor: fix silent truncation in spi_nor_read_raw() Sergei Shtylyov
  2019-11-02 10:50 ` [PATCH v2 0/2] Fix silent truncations in the SPI NOR driver Tudor.Ambarus
  2 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2019-10-30 18:48 UTC (permalink / raw)
  To: Marek Vasut, Tudor Ambarus, David Woodhouse, Brian Norris,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	linux-mtd

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.

Fixes: 59451e1233bd ("mtd: spi-nor: change return value of read/write")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
Changes in version 2:
- cleaned up the patch description.

 drivers/mtd/spi-nor/spi-nor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/mtd/spi-nor/spi-nor.c
===================================================================
--- linux.orig/drivers/mtd/spi-nor/spi-nor.c
+++ linux/drivers/mtd/spi-nor/spi-nor.c
@@ -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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] mtd: spi-nor: fix silent truncation in spi_nor_read_raw()
  2019-10-30 18:44 [PATCH v2 0/2] Fix silent truncations in the SPI NOR driver Sergei Shtylyov
  2019-10-30 18:48 ` [PATCH v2 1/2] mtd: spi-nor: fix silent truncation in spi_nor_read() Sergei Shtylyov
@ 2019-10-30 18:53 ` Sergei Shtylyov
  2019-11-02 10:50 ` [PATCH v2 0/2] Fix silent truncations in the SPI NOR driver Tudor.Ambarus
  2 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2019-10-30 18:53 UTC (permalink / raw)
  To: Marek Vasut, Tudor Ambarus, David Woodhouse, Brian Norris,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	linux-mtd

spi_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.

Fixes: f384b352cbf0 ("mtd: spi-nor: parse Serial Flash Discoverable Parameters (SFDP) tables")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
Changes in version 2:
- new patch.

 drivers/mtd/spi-nor/spi-nor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/mtd/spi-nor/spi-nor.c
===================================================================
--- linux.orig/drivers/mtd/spi-nor/spi-nor.c
+++ linux/drivers/mtd/spi-nor/spi-nor.c
@@ -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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] Fix silent truncations in the SPI NOR driver
  2019-10-30 18:44 [PATCH v2 0/2] Fix silent truncations in the SPI NOR driver Sergei Shtylyov
  2019-10-30 18:48 ` [PATCH v2 1/2] mtd: spi-nor: fix silent truncation in spi_nor_read() Sergei Shtylyov
  2019-10-30 18:53 ` [PATCH v2 2/2] mtd: spi-nor: fix silent truncation in spi_nor_read_raw() Sergei Shtylyov
@ 2019-11-02 10:50 ` Tudor.Ambarus
  2 siblings, 0 replies; 4+ messages in thread
From: Tudor.Ambarus @ 2019-11-02 10:50 UTC (permalink / raw)
  To: sergei.shtylyov, marek.vasut, dwmw2, computersforpeace,
	miquel.raynal, richard, vigneshr, linux-mtd



On 10/30/2019 08:44 PM, Sergei Shtylyov wrote:
> External E-Mail
> 
> 
> 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()
> 

Both applied to spi-nor/next. Thanks.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-02 10:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 18:44 [PATCH v2 0/2] Fix silent truncations in the SPI NOR driver Sergei Shtylyov
2019-10-30 18:48 ` [PATCH v2 1/2] mtd: spi-nor: fix silent truncation in spi_nor_read() Sergei Shtylyov
2019-10-30 18:53 ` [PATCH v2 2/2] mtd: spi-nor: fix silent truncation in spi_nor_read_raw() Sergei Shtylyov
2019-11-02 10:50 ` [PATCH v2 0/2] Fix silent truncations in the SPI NOR driver Tudor.Ambarus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.