Patch "riscv: mm: fix truncation warning on RV32" has been added to the 5.15-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

    riscv: mm: fix truncation warning on RV32

to the 5.15-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:
     riscv-mm-fix-truncation-warning-on-rv32.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 62b852f87a381fad15c88d1537b4ce16b42d9a24
Author: Jisheng Zhang <jszhang@xxxxxxxxxx>
Date:   Mon Jul 10 01:10:36 2023 +0800

    riscv: mm: fix truncation warning on RV32
    
    [ Upstream commit b690e266dae2f85f4dfea21fa6a05e3500a51054 ]
    
    lkp reports below sparse warning when building for RV32:
    arch/riscv/mm/init.c:1204:48: sparse: warning: cast truncates bits from
    constant value (100000000 becomes 0)
    
    IMO, the reason we didn't see this truncates bug in real world is "0"
    means MEMBLOCK_ALLOC_ACCESSIBLE in memblock and there's no RV32 HW
    with more than 4GB memory.
    
    Fix it anyway to make sparse happy.
    
    Fixes: decf89f86ecd ("riscv: try to allocate crashkern region from 32bit addressible memory")
    Signed-off-by: Jisheng Zhang <jszhang@xxxxxxxxxx>
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Closes: https://lore.kernel.org/oe-kbuild-all/202306080034.SLiCiOMn-lkp@xxxxxxxxx/
    Link: https://lore.kernel.org/r/20230709171036.1906-1-jszhang@xxxxxxxxxx
    Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index f8bfbe983517c..d7115acab3501 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -843,7 +843,7 @@ static void __init reserve_crashkernel(void)
 	 */
 	crash_base = memblock_phys_alloc_range(crash_size, PMD_SIZE,
 					       search_start,
-					       min(search_end, (unsigned long) SZ_4G));
+					       min(search_end, (unsigned long)(SZ_4G - 1)));
 	if (crash_base == 0) {
 		/* Try again without restricting region to 32bit addressible memory */
 		crash_base = memblock_phys_alloc_range(crash_size, PMD_SIZE,



[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