Patch "spi: airoha: fix airoha_snand_{write,read}_data data_len estimation" has been added to the 6.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    spi: airoha: fix airoha_snand_{write,read}_data data_len estimation

to the 6.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     spi-airoha-fix-airoha_snand_-write-read-_data-data_l.patch
and it can be found in the queue-6.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 879e026b7cb70b2271a5dc746033dc200c994204
Author: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
Date:   Fri Sep 13 23:07:14 2024 +0200

    spi: airoha: fix airoha_snand_{write,read}_data data_len estimation
    
    [ Upstream commit 0e58637eb968c636725dcd6c7055249b4e5326fb ]
    
    Fix data length written and read in airoha_snand_write_data and
    airoha_snand_read_data routines respectively if it is bigger than
    SPI_MAX_TRANSFER_SIZE.
    
    Fixes: a403997c1201 ("spi: airoha: add SPI-NAND Flash controller driver")
    Tested-by: Christian Marangi <ansuelsmth@xxxxxxxxx>
    Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
    Link: https://patch.msgid.link/20240913-airoha-spi-fixes-v1-2-de2e74ed4664@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/spi/spi-airoha-snfi.c b/drivers/spi/spi-airoha-snfi.c
index be3e4ac42153e..c71be702cf6f6 100644
--- a/drivers/spi/spi-airoha-snfi.c
+++ b/drivers/spi/spi-airoha-snfi.c
@@ -405,7 +405,7 @@ static int airoha_snand_write_data(struct airoha_snand_ctrl *as_ctrl, u8 cmd,
 	for (i = 0; i < len; i += data_len) {
 		int err;
 
-		data_len = min(len, SPI_MAX_TRANSFER_SIZE);
+		data_len = min(len - i, SPI_MAX_TRANSFER_SIZE);
 		err = airoha_snand_set_fifo_op(as_ctrl, cmd, data_len);
 		if (err)
 			return err;
@@ -427,7 +427,7 @@ static int airoha_snand_read_data(struct airoha_snand_ctrl *as_ctrl, u8 *data,
 	for (i = 0; i < len; i += data_len) {
 		int err;
 
-		data_len = min(len, SPI_MAX_TRANSFER_SIZE);
+		data_len = min(len - i, SPI_MAX_TRANSFER_SIZE);
 		err = airoha_snand_set_fifo_op(as_ctrl, 0xc, data_len);
 		if (err)
 			return err;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux