]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
riscv: mm: fix truncation warning on RV32
authorJisheng Zhang <jszhang@kernel.org>
Sun, 9 Jul 2023 17:10:36 +0000 (01:10 +0800)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:20:15 +0000 (17:20 +0200)
commit2525551d7f43b4500af0f4a80fd785e1bfb14974
tree99629a9c3f3546476221adba032387c1a37eb77b
parentbb231009312ea7b436fda568086428fea079ce70
riscv: mm: fix truncation warning on RV32

BugLink: https://bugs.launchpad.net/bugs/2036075
[ 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@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306080034.SLiCiOMn-lkp@intel.com/
Link: https://lore.kernel.org/r/20230709171036.1906-1-jszhang@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/riscv/mm/init.c