From: Benjamin Gray Date: Wed, 11 Oct 2023 05:37:08 +0000 (+1100) Subject: powerpc/uaccess: Cast away __user annotation after verification X-Git-Tag: v6.7-rc1~80^2~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6519c6df0722e432f330afbc7c00d16d5be5c58;p=thirdparty%2Fkernel%2Flinux.git powerpc/uaccess: Cast away __user annotation after verification Sparse reports dereference of a __user pointer. copy_mc_to_user() takes a __user pointer, verifies it, then calls the generic copy routine copy_mc_generic(). As we have verified the pointer, cast out the __user annotation when passing to copy_mc_generic(). Signed-off-by: Benjamin Gray Signed-off-by: Michael Ellerman Link: https://msgid.link/20231011053711.93427-10-bgray@linux.ibm.com --- diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index fb725ec77926e..f1f9890f50d3e 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -374,7 +374,7 @@ copy_mc_to_user(void __user *to, const void *from, unsigned long n) if (check_copy_size(from, n, true)) { if (access_ok(to, n)) { allow_write_to_user(to, n); - n = copy_mc_generic((void *)to, from, n); + n = copy_mc_generic((void __force *)to, from, n); prevent_write_to_user(to, n); } }