diff mbox series

binfmt_flat: fix sparse annotation ordering

Message ID 20220418200834.1501454-1-Niklas.Cassel@wdc.com (mailing list archive)
State New, archived
Headers show
Series binfmt_flat: fix sparse annotation ordering | expand

Commit Message

Niklas Cassel April 18, 2022, 8:09 p.m. UTC
From: Niklas Cassel <niklas.cassel@wdc.com>

The sparse annotation ordering inside the function call is swapped.

Fix the ordering so that we silence the following sparse warnings:
fs/binfmt_flat.c:816:39: warning: incorrect type in argument 1 (different address spaces)
fs/binfmt_flat.c:816:39:    expected unsigned int [noderef] [usertype] __user *rp
fs/binfmt_flat.c:816:39:    got unsigned int [usertype] *[noderef] __user

No functional change as sparse annotations are ignored by the compiler.

Fixes: a767e6fd68d2 ("binfmt_flat: do not stop relocating GOT entries prematurely on riscv")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Cc: <stable@vger.kernel.org>
---
Hello Kees,

Sorry about this.
Feel free to squash it with the existing patch if you so like.

 fs/binfmt_flat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kees Cook April 18, 2022, 10:01 p.m. UTC | #1
On Mon, Apr 18, 2022 at 08:09:12PM +0000, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
> 
> The sparse annotation ordering inside the function call is swapped.
> 
> Fix the ordering so that we silence the following sparse warnings:
> fs/binfmt_flat.c:816:39: warning: incorrect type in argument 1 (different address spaces)
> fs/binfmt_flat.c:816:39:    expected unsigned int [noderef] [usertype] __user *rp
> fs/binfmt_flat.c:816:39:    got unsigned int [usertype] *[noderef] __user
> 
> No functional change as sparse annotations are ignored by the compiler.
> 
> Fixes: a767e6fd68d2 ("binfmt_flat: do not stop relocating GOT entries prematurely on riscv")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> Cc: <stable@vger.kernel.org>
> ---
> Hello Kees,
> 
> Sorry about this.
> Feel free to squash it with the existing patch if you so like.

Ah-ha! Thanks; I was just looking at the sparse email. :)

-Kees

> 
>  fs/binfmt_flat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
> index e5e2a03b39c1..dca0b6875f9c 100644
> --- a/fs/binfmt_flat.c
> +++ b/fs/binfmt_flat.c
> @@ -813,7 +813,7 @@ static int load_flat_file(struct linux_binprm *bprm,
>  	 * image.
>  	 */
>  	if (flags & FLAT_FLAG_GOTPIC) {
> -		rp = skip_got_header((u32 * __user) datapos);
> +		rp = skip_got_header((u32 __user *) datapos);
>  		for (; ; rp++) {
>  			u32 addr, rp_val;
>  			if (get_user(rp_val, rp))
> -- 
> 2.35.1
diff mbox series

Patch

diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index e5e2a03b39c1..dca0b6875f9c 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -813,7 +813,7 @@  static int load_flat_file(struct linux_binprm *bprm,
 	 * image.
 	 */
 	if (flags & FLAT_FLAG_GOTPIC) {
-		rp = skip_got_header((u32 * __user) datapos);
+		rp = skip_got_header((u32 __user *) datapos);
 		for (; ; rp++) {
 			u32 addr, rp_val;
 			if (get_user(rp_val, rp))