RISC-V: Avoid dereferening NULL regs in die()
authorPalmer Dabbelt <palmer@rivosinc.com>
Tue, 20 Sep 2022 20:00:37 +0000 (13:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:48:51 +0000 (08:48 +0100)
commit5ab1d0528b0401ccf53e256f038b775354fdb693
tree0875302b48c795738ebfb5f1ac1527072846c333
parent6a72729ed6accc86dad5522895e8fa2f96642a2c
RISC-V: Avoid dereferening NULL regs in die()

[ Upstream commit f2913d006fcdb61719635e093d1b5dd0dafecac7 ]

I don't think we can actually die() without a regs pointer, but the
compiler was warning about a NULL check after a dereference.  It seems
prudent to just avoid the possibly-NULL dereference, given that when
die()ing the system is already toast so who knows how we got there.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20220920200037.6727-1-palmer@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Stable-dep-of: 130aee3fd998 ("riscv: Avoid enabling interrupts in die()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/riscv/kernel/traps.c