]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
do_sys_openat2(): get rid of useless check, switch to CLASS(filename)
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 28 Oct 2025 04:11:45 +0000 (00:11 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 13 Jan 2026 20:18:08 +0000 (15:18 -0500)
do_file_open() will do the right thing when given ERR_PTR() as name...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/open.c

index 3d2e2a2554c5a0e55002dba5814288a519377a5a..ac8dedea8dafc9cc6a0551a4257770b5f22e9bb6 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -1425,18 +1425,12 @@ static int do_sys_openat2(int dfd, const char __user *filename,
                          struct open_how *how)
 {
        struct open_flags op;
-       struct filename *tmp __free(putname) = NULL;
-       int err;
-
-       err = build_open_flags(how, &op);
+       int err = build_open_flags(how, &op);
        if (unlikely(err))
                return err;
 
-       tmp = getname(filename);
-       if (IS_ERR(tmp))
-               return PTR_ERR(tmp);
-
-       return FD_ADD(how->flags, do_file_open(dfd, tmp, &op));
+       CLASS(filename, name)(filename);
+       return FD_ADD(how->flags, do_file_open(dfd, name, &op));
 }
 
 int do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)