Patch "regmap: spi-avmm: Fix regmap_bus max_raw_write" has been added to the 6.1-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

    regmap: spi-avmm: Fix regmap_bus max_raw_write

to the 6.1-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:
     regmap-spi-avmm-fix-regmap_bus-max_raw_write.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 730e76b05bbba648a6c11918b5e6ddcf46d76d16
Author: Russ Weight <russell.h.weight@xxxxxxxxx>
Date:   Tue Jun 20 13:28:24 2023 -0700

    regmap: spi-avmm: Fix regmap_bus max_raw_write
    
    [ Upstream commit c8e796895e2310b6130e7577248da1d771431a77 ]
    
    The max_raw_write member of the regmap_spi_avmm_bus structure is defined
    as:
            .max_raw_write = SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT
    
    SPI_AVMM_VAL_SIZE == 4 and MAX_WRITE_CNT == 1 so this results in a
    maximum write transfer size of 4 bytes which provides only enough space to
    transfer the address of the target register. It provides no space for the
    value to be transferred. This bug became an issue (divide-by-zero in
    _regmap_raw_write()) after the following was accepted into mainline:
    
    commit 3981514180c9 ("regmap: Account for register length when chunking")
    
    Change max_raw_write to include space (4 additional bytes) for both the
    register address and value:
    
            .max_raw_write = SPI_AVMM_REG_SIZE + SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT
    
    Fixes: 7f9fb67358a2 ("regmap: add Intel SPI Slave to AVMM Bus Bridge support")
    Reviewed-by: Matthew Gerlach <matthew.gerlach@xxxxxxxxxxxxxxx>
    Signed-off-by: Russ Weight <russell.h.weight@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230620202824.380313-1-russell.h.weight@xxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/base/regmap/regmap-spi-avmm.c b/drivers/base/regmap/regmap-spi-avmm.c
index 4c2b94b3e30be..6af692844c196 100644
--- a/drivers/base/regmap/regmap-spi-avmm.c
+++ b/drivers/base/regmap/regmap-spi-avmm.c
@@ -660,7 +660,7 @@ static const struct regmap_bus regmap_spi_avmm_bus = {
 	.reg_format_endian_default = REGMAP_ENDIAN_NATIVE,
 	.val_format_endian_default = REGMAP_ENDIAN_NATIVE,
 	.max_raw_read = SPI_AVMM_VAL_SIZE * MAX_READ_CNT,
-	.max_raw_write = SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT,
+	.max_raw_write = SPI_AVMM_REG_SIZE + SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT,
 	.free_context = spi_avmm_bridge_ctx_free,
 };
 



[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