From patchwork Wed May 1 16:06:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 1093739 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FZDQU62u"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44vNZj71jRz9s3Z for ; Thu, 2 May 2019 02:07:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H5sGdt8mZTdSMk66SemR7bxqcoLihqz+hSXNygOzizk=; b=FZDQU62u9kMJxX Q2HfDnNJI4WGwSTA8pg+BDG7tRQQMul9+zxqLmsjloL5vJsm+V7K4ACoCQ7fMA+H4g9bkIrdy/QT2 sAvY32YrrM0nA/8pxUOZ7DLeN+2suqXjqtyDAmrYH1do0WkUCUi8ump1gVHcwrLlZT76jHUwEVf53 3ITJsCezynQ9hwiDXWGjF8bg1nOZHFsh0QHp6fU6f4cwBfU5hSD1OI09b90pRz0q8Zg+Tyvdh4EFB iNjZoQ5Y2gMDh6pRbc0b7dRwwJhl/+g+ECRLkldlZNlGVAb5lu81gBuy+iwwka94Vh06ylazR5kSM HVE8tIMDwN4vyY8+WznA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLrlR-0008TC-Rz; Wed, 01 May 2019 16:07:21 +0000 Received: from adsl-173-228-226-134.prtc.net ([173.228.226.134] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLrlL-0008Kv-Eh; Wed, 01 May 2019 16:07:15 +0000 From: Christoph Hellwig To: Andrew Morton Subject: [PATCH 1/4] mm: fix an overly long line in read_cache_page Date: Wed, 1 May 2019 12:06:33 -0400 Message-Id: <20190501160636.30841-2-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190501160636.30841-1-hch@lst.de> References: <20190501160636.30841-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nfs@vger.kernel.org, Kees Cook , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, Sami Tolvanen Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Christoph Hellwig --- mm/filemap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index d78f577baef2..a2fc59f56f50 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2956,7 +2956,8 @@ struct page *read_cache_page(struct address_space *mapping, int (*filler)(void *, struct page *), void *data) { - return do_read_cache_page(mapping, index, filler, data, mapping_gfp_mask(mapping)); + return do_read_cache_page(mapping, index, filler, data, + mapping_gfp_mask(mapping)); } EXPORT_SYMBOL(read_cache_page); From patchwork Wed May 1 16:06:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 1093740 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RhdU3mwA"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44vNZy49Cbz9s9G for ; Thu, 2 May 2019 02:07:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3IDY3cbXX+y7mCBo9KCjnvUBLt3vKikU/zV6t4A0lws=; b=RhdU3mwA0dNrhC 8mDX66Pbxv2Kb4MpeVOTHD9l22eokxy/R9TIx91/UUrjeJPE1IjBwg9N91pN1ar75GHuNAowg+oW7 qqEvJRbxIghbNzsjygQuP3C84hYKfczXnGuptuT0y1KangBiCfgIAyCPszEqEpyTtMQpbbdEoAfXK yS8QHEDmGw4W0lWCjQKgNHRHS8fZAN9hZJn/esFuuKnaG5DoiJG3xE0XqHyOwOxFtCPwEibKOspr0 FprT6MZBDztZkccPH2ntELaXB4dsav4InUGjKDNi4gxhDAulpZcRfHRFRaxWOjveqrPkpkobq4AxP 2SgFQNtI/nRBmbgTCMJQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLrld-0000LC-EW; Wed, 01 May 2019 16:07:33 +0000 Received: from adsl-173-228-226-134.prtc.net ([173.228.226.134] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLrlM-0008L9-Sy; Wed, 01 May 2019 16:07:17 +0000 From: Christoph Hellwig To: Andrew Morton Subject: [PATCH 2/4] mm: don't cast ->readpage to filler_t for do_read_cache_page Date: Wed, 1 May 2019 12:06:34 -0400 Message-Id: <20190501160636.30841-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190501160636.30841-1-hch@lst.de> References: <20190501160636.30841-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nfs@vger.kernel.org, Kees Cook , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, Sami Tolvanen Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We can just pass a NULL filler and do the right thing inside of do_read_cache_page based on the NULL parameter. Signed-off-by: Christoph Hellwig --- include/linux/pagemap.h | 3 +-- mm/filemap.c | 10 ++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index bcf909d0de5f..f52c3a2074cd 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -386,8 +386,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); } /* diff --git a/mm/filemap.c b/mm/filemap.c index a2fc59f56f50..51f5b02c299a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2866,7 +2866,11 @@ static struct page *do_read_cache_page(struct address_space *mapping, } 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); @@ -2978,9 +2982,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); From patchwork Wed May 1 16:06:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 1093741 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fCP4Sjop"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44vNb90RYDz9s3Z for ; Thu, 2 May 2019 02:07:49 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EmhOH2FfUoA1Qp6OTNd7SoPxgG9UEmvoqU9oFLJl5Y4=; b=fCP4SjopzlFZl2 jUi3po+UedNcPVDyPISFcDYHbdkyXQTk/KYyF1eSqO6tXgGZLo2Fk9bgDvYJyNd38Q2yjuQ08ualg gopQyJFuC/Jzic5nvvvFvsg/5dRJhSqF/1fkz13T13fJCbjbWt2vWqZb+nforqh1z6vNc1kU5B+ol SoxLHNthznq+rXMIKDQ9YBhrhC49ypyd5X/n85WKOn+/p5//F0eeewmZs4wNn/JD1q3BH7J7eCJoi mC3wRj9i+xxJkju7qXcaeQhecqi50+3JvRiwJ2vN13CAiddUMXCoH0oIGA6i6sbCtUTmNKnWkRFyZ hgxRhtRwIfRqD/Dpm+NA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLrln-0000cD-JX; Wed, 01 May 2019 16:07:43 +0000 Received: from adsl-173-228-226-134.prtc.net ([173.228.226.134] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLrlO-0008Mh-Dh; Wed, 01 May 2019 16:07:18 +0000 From: Christoph Hellwig To: Andrew Morton Subject: [PATCH 3/4] nfs: pass the correct prototype to read_cache_page Date: Wed, 1 May 2019 12:06:35 -0400 Message-Id: <20190501160636.30841-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190501160636.30841-1-hch@lst.de> References: <20190501160636.30841-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nfs@vger.kernel.org, Kees Cook , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, Sami Tolvanen Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Fix the callbacks NFS 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. Signed-off-by: Christoph Hellwig --- fs/nfs/dir.c | 7 ++++--- fs/nfs/symlink.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index a71d0b42d160..47d445bec8c9 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -714,8 +714,9 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, * We only need to convert from xdr once so future lookups are much simpler */ static -int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page) +int nfs_readdir_filler(void *data, struct page* page) { + nfs_readdir_descriptor_t *desc = data; struct inode *inode = file_inode(desc->file); int ret; @@ -762,8 +763,8 @@ void cache_page_release(nfs_readdir_descriptor_t *desc) static struct page *get_cache_page(nfs_readdir_descriptor_t *desc) { - return read_cache_page(desc->file->f_mapping, - desc->page_index, (filler_t *)nfs_readdir_filler, desc); + return read_cache_page(desc->file->f_mapping, desc->page_index, + nfs_readdir_filler, desc); } /* diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c index 06eb44b47885..25ba299fdac2 100644 --- a/fs/nfs/symlink.c +++ b/fs/nfs/symlink.c @@ -26,8 +26,9 @@ * and straight-forward than readdir caching. */ -static int nfs_symlink_filler(struct inode *inode, struct page *page) +static int nfs_symlink_filler(void *data, struct page *page) { + struct inode *inode = data; int error; error = NFS_PROTO(inode)->readlink(inode, page, 0, PAGE_SIZE); @@ -65,8 +66,8 @@ static const char *nfs_get_link(struct dentry *dentry, err = ERR_PTR(nfs_revalidate_mapping(inode, inode->i_mapping)); if (err) return err; - page = read_cache_page(&inode->i_data, 0, - (filler_t *)nfs_symlink_filler, inode); + page = read_cache_page(&inode->i_data, 0, nfs_symlink_filler, + inode); if (IS_ERR(page)) return ERR_CAST(page); } From patchwork Wed May 1 16:06:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 1093742 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hbJCF7W9"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44vNbL2ny7z9s3Z for ; Thu, 2 May 2019 02:07:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7fFT5wNZ/KHiEQWcnFZEGal7spDdBxElv5JKdepPPTU=; b=hbJCF7W9PoNgXY DHdjgO+5CQlBlainmpV1efqq0IlMYSINI//hDZ/ceJoA+HUjKWRdtvEO2kdLzmJhJrMW3LhIHJy2d FuCCIex32pSS/f4GFE5qUQtYbXIf7uehtZrpk824EYcaNZkiQcBk3Wvpgk2/S/SjRa0OLEkbh8JkK XHUecVzza6yXcoGtQcnUOA7pXEjAL6VA3hI3TwDeF3bfrwZYOTh+8Ld6G0Jqf2/Kw3hiAYGWlsEF5 XplykCAjwfJYSYZjfoMTeaP/GiX3l/34tShSX1t6n2VGKV+JyiI4ixF7OsbwYQAWgY/0qK9c7O9m/ lg3LRE8+OYTa4KmDQkYQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLrly-0000sY-6D; Wed, 01 May 2019 16:07:54 +0000 Received: from adsl-173-228-226-134.prtc.net ([173.228.226.134] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLrlQ-0008P9-2K; Wed, 01 May 2019 16:07:20 +0000 From: Christoph Hellwig To: Andrew Morton Subject: [PATCH 4/4] jffs2: pass the correct prototype to read_cache_page Date: Wed, 1 May 2019 12:06:36 -0400 Message-Id: <20190501160636.30841-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190501160636.30841-1-hch@lst.de> References: <20190501160636.30841-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nfs@vger.kernel.org, Kees Cook , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, Sami Tolvanen Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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. Signed-off-by: Christoph Hellwig --- fs/jffs2/file.c | 4 ++-- fs/jffs2/fs.c | 2 +- fs/jffs2/os-linux.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 7d8654a1472e..f8fb89b10227 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -109,9 +109,9 @@ static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg) return ret; } -int jffs2_do_readpage_unlock(struct inode *inode, struct page *pg) +int jffs2_do_readpage_unlock(void *data, struct page *pg) { - int ret = jffs2_do_readpage_nolock(inode, pg); + int ret = jffs2_do_readpage_nolock(data, pg); unlock_page(pg); return ret; } diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index eab04eca95a3..7fbe8a7843b9 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c @@ -686,7 +686,7 @@ unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, struct page *pg; pg = read_cache_page(inode->i_mapping, offset >> PAGE_SHIFT, - (void *)jffs2_do_readpage_unlock, inode); + jffs2_do_readpage_unlock, inode); if (IS_ERR(pg)) return (void *)pg; diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index a2dbbb3f4c74..bd3d5f0ddc34 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h @@ -155,7 +155,7 @@ extern const struct file_operations jffs2_file_operations; extern const struct inode_operations jffs2_file_inode_operations; extern const struct address_space_operations jffs2_file_address_operations; int jffs2_fsync(struct file *, loff_t, loff_t, int); -int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); +int jffs2_do_readpage_unlock(void *data, struct page *pg); /* ioctl.c */ long jffs2_ioctl(struct file *, unsigned int, unsigned long); From patchwork Wed May 1 17:34:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 1093758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="p8s+LmT9"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44vQWz5FQQz9sNl for ; Thu, 2 May 2019 03:35:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c1LBAw7I39Peu/3ZJh2lWLd3lZnY3tS2xj9EJVSIIAc=; b=p8s+LmT9P5QeOE cWLJml682AmyOgmPb52jbHTA2y9OTdWlEF+bQ+y0Db4tAVdy6fqRPTiVxfxDX3ywVctADhI7hS1e5 lydz9ECgyp/fY+NgzWtrWiGO53HVVZR6q5ficrolp0TH8bLn0uTsok6PBr8NG0tnNtw+1MzsspiMC tBy2hwK3wrbPjS3T97wfT2uSJD5PvUB0aBf3Uuayy3c4Ljkb/bcjAoaOJ4+AK0bUAWhS2ZxsnZCrX 5oi63r9nKnGjGD+JA4L4u6OGKaRsXhbcCb2ANZ2ZIRDPZhmzvIojb1C+nLKoJbiszbOYtJ+Pv4M0c iE5RmZn+C3LhWjpFpKtQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLt8K-0003Om-QP; Wed, 01 May 2019 17:35:04 +0000 Received: from verein.lst.de ([213.95.11.211] helo=newverein.lst.de) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLt8H-0002zd-W6 for linux-mtd@lists.infradead.org; Wed, 01 May 2019 17:35:03 +0000 Received: by newverein.lst.de (Postfix, from userid 2407) id 5364068AFE; Wed, 1 May 2019 19:34:43 +0200 (CEST) Date: Wed, 1 May 2019 19:34:43 +0200 From: Christoph Hellwig To: Andrew Morton Subject: [PATCH 5/4] 9p: pass the correct prototype to read_cache_page Message-ID: <20190501173443.GA19969@lst.de> References: <20190501160636.30841-1-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190501160636.30841-1-hch@lst.de> User-Agent: Mutt/1.5.17 (2007-11-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190501_103502_284013_CDCBA371 X-CRM114-Status: GOOD ( 10.85 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [213.95.11.211 listed in list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nfs@vger.kernel.org, Kees Cook , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, Sami Tolvanen Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Fix the callback 9p 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. Signed-off-by: Christoph Hellwig Reviewed-by: William Kucharski --- fs/9p/vfs_addr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index 0bcbcc20f769..02e0fc51401e 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -50,8 +50,9 @@ * @page: structure to page * */ -static int v9fs_fid_readpage(struct p9_fid *fid, struct page *page) +static int v9fs_fid_readpage(void *data, struct page *page) { + struct p9_fid *fid = data; struct inode *inode = page->mapping->host; struct bio_vec bvec = {.bv_page = page, .bv_len = PAGE_SIZE}; struct iov_iter to; @@ -122,7 +123,8 @@ static int v9fs_vfs_readpages(struct file *filp, struct address_space *mapping, if (ret == 0) return ret; - ret = read_cache_pages(mapping, pages, (void *)v9fs_vfs_readpage, filp); + ret = read_cache_pages(mapping, pages, v9fs_fid_readpage, + filp->private_data); p9_debug(P9_DEBUG_VFS, " = %d\n", ret); return ret; }