diff mbox series

[v1,1/5] fs: make user_path_at_empty() take a struct filename

Message ID 20211129221257.2536146-2-shr@fb.com (mailing list archive)
State New, archived
Headers show
Series io_uring: add xattr support | expand

Commit Message

Stefan Roesch Nov. 29, 2021, 10:12 p.m. UTC
Summary:

- Changes the user_path_at_empty function to take a filename
  struct instead of an user character pointer.
- It also includes the necessary changes in stat.c and namei.c
  to call the user_path_at_empty function.

Signed-off-by: Stefan Roesch <shr@fb.com>
---
 fs/namei.c            | 5 ++---
 fs/stat.c             | 7 ++++++-
 include/linux/namei.h | 4 ++--
 3 files changed, 10 insertions(+), 6 deletions(-)

Comments

kernel test robot Nov. 30, 2021, 2:09 a.m. UTC | #1
Hi Stefan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on c2626d30f312afc341158e07bf088f5a23b4eeeb]

url:    https://github.com/0day-ci/linux/commits/Stefan-Roesch/io_uring-add-xattr-support/20211130-061448
base:   c2626d30f312afc341158e07bf088f5a23b4eeeb
config: m68k-defconfig (https://download.01.org/0day-ci/archive/20211130/202111301052.fMLJlgVf-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/01c97d7409d5384e3cb760a9a99fa0c61899fc18
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Stefan-Roesch/io_uring-add-xattr-support/20211130-061448
        git checkout 01c97d7409d5384e3cb760a9a99fa0c61899fc18
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "getname_flags" [fs/ocfs2/ocfs2.ko] undefined!
ERROR: modpost: "getname_flags" [fs/xfs/xfs.ko] undefined!
>> ERROR: modpost: "getname_flags" [fs/coda/coda.ko] undefined!

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/fs/namei.c b/fs/namei.c
index 1f9d2187c765..baf34cde9ecd 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2794,10 +2794,9 @@  int path_pts(struct path *path)
 }
 #endif
 
-int user_path_at_empty(int dfd, const char __user *name, unsigned flags,
-		 struct path *path, int *empty)
+int user_path_at_empty(int dfd, struct filename *filename, unsigned flags,
+		       struct path *path)
 {
-	struct filename *filename = getname_flags(name, flags, empty);
 	int ret = filename_lookup(dfd, filename, flags, path, NULL);
 
 	putname(filename);
diff --git a/fs/stat.c b/fs/stat.c
index 28d2020ba1f4..d8752c103062 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -435,12 +435,17 @@  static int do_readlinkat(int dfd, const char __user *pathname,
 	int error;
 	int empty = 0;
 	unsigned int lookup_flags = LOOKUP_EMPTY;
+	struct filename *filename;
 
 	if (bufsiz <= 0)
 		return -EINVAL;
 
 retry:
-	error = user_path_at_empty(dfd, pathname, lookup_flags, &path, &empty);
+	filename = getname_flags(pathname, lookup_flags, &empty);
+	if (IS_ERR(filename))
+		return PTR_ERR(filename);
+
+	error = user_path_at_empty(dfd, filename, lookup_flags, &path);
 	if (!error) {
 		struct inode *inode = d_backing_inode(path.dentry);
 
diff --git a/include/linux/namei.h b/include/linux/namei.h
index e89329bb3134..dc1ae29478b0 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -49,12 +49,12 @@  enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT};
 
 extern int path_pts(struct path *path);
 
-extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty);
+extern int user_path_at_empty(int, struct filename *, unsigned, struct path *);
 
 static inline int user_path_at(int dfd, const char __user *name, unsigned flags,
 		 struct path *path)
 {
-	return user_path_at_empty(dfd, name, flags, path, NULL);
+	return user_path_at_empty(dfd, getname_flags(name, flags, NULL), flags, path);
 }
 
 extern int kern_path(const char *, unsigned, struct path *);