Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

jffs2: pass the correct prototype to read_cache_page

Fix the callback jffs2 passes to read_cache_page to actually have the
proper type expected. Casting around function pointers can easily hide
typing bugs, and defeats control flow protection.

Link: http://lkml.kernel.org/r/20190520055731.24538-4-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>

authored by

Christoph Hellwig and committed by
Linus Torvalds
265de8ce 6c45b454

+4 -4
+2 -2
fs/jffs2/file.c
··· 109 109 return ret; 110 110 } 111 111 112 - int jffs2_do_readpage_unlock(struct inode *inode, struct page *pg) 112 + int jffs2_do_readpage_unlock(void *data, struct page *pg) 113 113 { 114 - int ret = jffs2_do_readpage_nolock(inode, pg); 114 + int ret = jffs2_do_readpage_nolock(data, pg); 115 115 unlock_page(pg); 116 116 return ret; 117 117 }
+1 -1
fs/jffs2/fs.c
··· 687 687 struct page *pg; 688 688 689 689 pg = read_cache_page(inode->i_mapping, offset >> PAGE_SHIFT, 690 - (void *)jffs2_do_readpage_unlock, inode); 690 + jffs2_do_readpage_unlock, inode); 691 691 if (IS_ERR(pg)) 692 692 return (void *)pg; 693 693
+1 -1
fs/jffs2/os-linux.h
··· 155 155 extern const struct inode_operations jffs2_file_inode_operations; 156 156 extern const struct address_space_operations jffs2_file_address_operations; 157 157 int jffs2_fsync(struct file *, loff_t, loff_t, int); 158 - int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); 158 + int jffs2_do_readpage_unlock(void *data, struct page *pg); 159 159 160 160 /* ioctl.c */ 161 161 long jffs2_ioctl(struct file *, unsigned int, unsigned long);