]> www.infradead.org Git - users/dwmw2/linux.git/commit
arm64/signal: Silence sparse warning storing GCSPR_EL0
authorMark Brown <broonie@kernel.org>
Sat, 14 Dec 2024 02:12:06 +0000 (02:12 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 20 Dec 2024 14:12:04 +0000 (14:12 +0000)
commit926e862058978a8f81872845715d67ad21c30f65
tree55f88204b611ebf0468f93f902e01bf7b245c984
parentce03573a1917532da06057da9f8e74a2ee9e2ac9
arm64/signal: Silence sparse warning storing GCSPR_EL0

We are seeing a sparse warning in gcs_restore_signal():

  arch/arm64/kernel/signal.c:1054:9: sparse: sparse: cast removes address space '__user' of expression

when storing the final GCSPR_EL0 value back into the register, caused by
the fact that write_sysreg_s() casts the value it writes to a u64 which
sparse sees as discarding the __userness of the pointer.

Avoid this by treating the address as an integer, casting to a pointer only
when using it to write to userspace.

While we're at it also inline gcs_signal_cap_valid() into it's one user
and make equivalent updates to gcs_signal_entry().

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202412082005.OBJ0BbWs-lkp@intel.com/
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20241214-arm64-gcs-signal-sparse-v3-1-5e8d18fffc0c@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/signal.c