]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm/filemap: don't cast ->readpage to filler_t for do_read_cache_page
authorChristoph Hellwig <hch@lst.de>
Fri, 12 Jul 2019 03:55:20 +0000 (20:55 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 12 Jul 2019 18:05:43 +0000 (11:05 -0700)
We can just pass a NULL filler and do the right thing inside of
do_read_cache_page based on the NULL parameter.

Link: http://lkml.kernel.org/r/20190520055731.24538-3-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/pagemap.h
mm/filemap.c

index 6fd0d3aa492ce54ceed2b9566287dabf9953b582..c7552459a15f5763f6c47b58dcda6980f6881a53 100644 (file)
@@ -383,8 +383,7 @@ extern int read_cache_pages(struct address_space *mapping,
 static inline struct page *read_mapping_page(struct address_space *mapping,
                                pgoff_t index, void *data)
 {
-       filler_t *filler = (filler_t *)mapping->a_ops->readpage;
-       return read_cache_page(mapping, index, filler, data);
+       return read_cache_page(mapping, index, NULL, data);
 }
 
 /*
index d6f7596f148f6f566024a24f5fbc8f0d449e91be..1e5e006b8557caea4e49455f3300c4cd22e73532 100644 (file)
@@ -2825,7 +2825,11 @@ repeat:
                }
 
 filler:
-               err = filler(data, page);
+               if (filler)
+                       err = filler(data, page);
+               else
+                       err = mapping->a_ops->readpage(data, page);
+
                if (err < 0) {
                        put_page(page);
                        return ERR_PTR(err);
@@ -2937,9 +2941,7 @@ struct page *read_cache_page_gfp(struct address_space *mapping,
                                pgoff_t index,
                                gfp_t gfp)
 {
-       filler_t *filler = (filler_t *)mapping->a_ops->readpage;
-
-       return do_read_cache_page(mapping, index, filler, NULL, gfp);
+       return do_read_cache_page(mapping, index, NULL, NULL, gfp);
 }
 EXPORT_SYMBOL(read_cache_page_gfp);