Skip to contentSkip to conversation

fs/namespace: add __user to open_tree and move_mount syscalls

PATCH In review Ben Dooks 2 participants 2 messages Oct 15, 2019 VFS

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 fs/namespace: add __user to open_tree and move_mount syscalls

Thw open_tree and move_mount syscalls take names from the user, so add the __user to these to ensure the following warnings from sparse are fixed:

fs/namespace.c:2392:35: warning: incorrect type in argument 2 (different address spaces)
fs/namespace.c:2392:35: expected char const [noderef] <asn:1> *name
fs/namespace.c:2392:35: got char const *filename
fs/namespace.c:3541:38: warning: incorrect type in argument 2 (different address spaces)
fs/namespace.c:3541:38: expected char const [noderef] <asn:1> *name
fs/namespace.c:3541:38: got char const *from_pathname
fs/namespace.c:3550:36: warning: incorrect type in argument 2 (different address spaces)
fs/namespace.c:3550:36: expected char const [noderef] <asn:1> *name
fs/namespace.c:3550:36: got char const *to_pathname

---
Cc: Alexander Viro <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 fs/namespace.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/namespace.c +3 -3
index b87b127fdce4..ed37564ccbb3 100644
@@ -2356,7 +2356,7 @@ static struct file *open_detached_copy(struct path *path, bool recursive)
 	return file;
 }
 
-SYSCALL_DEFINE3(open_tree, int, dfd, const char *, filename, unsigned, flags)
+SYSCALL_DEFINE3(open_tree, int, dfd, const char __user *, filename, unsigned, flags)
 {
 	struct file *file;
 	struct path path;
@@ -3515,8 +3515,8 @@ SYSCALL_DEFINE3(fsmount, int, fs_fd, unsigned int, flags,
  * Note the flags value is a combination of MOVE_MOUNT_* flags.
  */
 SYSCALL_DEFINE5(move_mount,
-		int, from_dfd, const char *, from_pathname,
-		int, to_dfd, const char *, to_pathname,
+		int, from_dfd, const char __user *, from_pathname,
+		int, to_dfd, const char __user *, to_pathname,
 		unsigned int, flags)
 {
 	struct path from_path, to_path;
Signature · 1 line
2.23.0
#1 lore raw

fs/namespace.c static struct file *open_detached_copy(struct path *path, bool recursive) · line 2359

Quoted 2 lines · Ben Dooks
fs/namespace.c +1 -1
-SYSCALL_DEFINE3(open_tree, int, dfd, const char *, filename, unsigned, flags)
+SYSCALL_DEFINE3(open_tree, int, dfd, const char __user *, filename, unsigned, flags)

Please make sure to wrap lines after 80 characters.

Otherwise this looks good.