Subject: Re: linux-next: build warning after merge of the vfs-brauner tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 28 May 2024 13:31:04 +1000

Hi all,

On Tue, 28 May 2024 10:49:05 +1000 Stephen Rothwell <[email-masked]> wrote:
> 
> After merging the vfs-brauner tree, today's linux-next build (arm
> multi_v7_defconfig) produced this warning:
> 
> fs/xattr.c: In function '__do_sys_setxattrat':
> fs/xattr.c:709:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>   709 |         return do_setxattrat(dfd, pathname, at_flags, name, (const void __user *)args.value,
>       |                                                             ^
> fs/xattr.c: In function '__do_sys_getxattrat':
> fs/xattr.c:855:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>   855 |         return do_getxattrat(dfd, pathname, at_flags, name, (void __user *)args.value, args.size);
>       |                                                             ^
> 
> Introduced by commit
> 
>   89345b0ac5ac ("fs/xattr: add *at family syscalls")

This became a build failure in the i386 defconfig build, so I applied
the following fix patch.

From: Stephen Rothwell <[email-masked]>
Date: Tue, 28 May 2024 13:20:29 +1000
Subject: [PATCH] fix up for "fs/xattr: add *at family syscalls"

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 fs/xattr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/xattr.c b/fs/xattr.c
index 8e712795ab80..d0d54ae2f9cb 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -706,7 +706,8 @@ SYSCALL_DEFINE6(setxattrat, int, dfd, const char __user *, pathname, unsigned in
 	if (error)
 		return error;
 
-	return do_setxattrat(dfd, pathname, at_flags, name, (const void __user *)args.value,
+	return do_setxattrat(dfd, pathname, at_flags, name,
+			     (const void __user *)(unsigned long)args.value,
 			     args.size, args.flags);
 }
 
@@ -852,7 +853,9 @@ SYSCALL_DEFINE6(getxattrat, int, dfd, const char __user *, pathname, unsigned in
 	if (args.flags != 0)
 		return -EINVAL;
 
-	return do_getxattrat(dfd, pathname, at_flags, name, (void __user *)args.value, args.size);
+	return do_getxattrat(dfd, pathname, at_flags, name,
+			     (void __user *)(unsigned long)args.value,
+			     args.size);
 }
 
 SYSCALL_DEFINE4(getxattr, const char __user *, pathname,
-- 
2.43.0

-- 
Cheers,
Stephen Rothwell