]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
fs/sync.c: remove unnecessary NULL f_mapping check in sync_file_range
authorJeff Layton <jlayton@redhat.com>
Wed, 6 Sep 2017 23:23:19 +0000 (16:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Sep 2017 00:27:28 +0000 (17:27 -0700)
fsync codepath assumes that f_mapping can never be NULL, but
sync_file_range has a check for that.

Remove the one from sync_file_range as I don't see how you'd ever get a
NULL pointer in here.

Link: http://lkml.kernel.org/r/20170525110509.9434-1-jlayton@redhat.com
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/sync.c

index 2a54c1f2203595823df1bd97680b9a1fb163e400..cf57f33fcd160f358945632a3dd87419684e8e3f 100644 (file)
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -335,11 +335,6 @@ SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes,
                goto out_put;
 
        mapping = f.file->f_mapping;
-       if (!mapping) {
-               ret = -EINVAL;
-               goto out_put;
-       }
-
        ret = 0;
        if (flags & SYNC_FILE_RANGE_WAIT_BEFORE) {
                ret = filemap_fdatawait_range(mapping, offset, endbyte);