From patchwork Mon May 20 05:57:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10949955 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 484216C5 for ; Mon, 20 May 2019 05:58:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39215205FC for ; Mon, 20 May 2019 05:58:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DB4628179; Mon, 20 May 2019 05:58:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D122928647 for ; Mon, 20 May 2019 05:58:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1C4F6B000C; Mon, 20 May 2019 01:58:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id ACD356B027A; Mon, 20 May 2019 01:58:32 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9462F6B027B; Mon, 20 May 2019 01:58:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 5D7386B000C for ; Mon, 20 May 2019 01:58:32 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id 11so7215688pfb.4 for ; Sun, 19 May 2019 22:58:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=MsXW1oUHr05ZSy88t0Z7I0GXKd9SSvBG18rggV2Vu2g=; b=rtudwQg4N1V/4iPV9MjLp3owZ6GJtH2fzjhiBhXEB3ok+Mzkwb9liB9C75IydYpRp1 NLfWzuYZLlYC0ty6sQsOTYkSuJnC+op/Z24J6RI8Xm/bzmIxLGvGoU6Mce73TXGko7s9 i01XYA0nliQzeOBp0FocNwXzWMRi5aPAWRkYp/4f/ZP0td9TqZ1Tif3yXfCb96QKY605 wy7VtN+SQ60ommjthwWEyghUIsf9FIstgILfVHef15HLqlP071MlcK+UO4Ux9tLNiyi7 3kdu+16utuu45ggio8YXgj+ioaMN72TFBG3DUfwV+BwrT+DYs56inSxLUTCWEHKtk9o8 BVxA== X-Gm-Message-State: APjAAAXVDQsu2wpvKA+006bVPqJuGLPo2cBPKKHOXYfD0mQBLsm0DVfk n5BgYhs2nTooPHQI/EeOAyRN8ifFaOncKKoFekWniJK83YCcgbvFY2wTWvHBtbzHFDkt9Q25pGT zzfiJ3sFbhnPOU0j4VfBwMqaTKMTtL0rbHa2v9xWxum8KbL3Bif72pQMiLZIz/Tw= X-Received: by 2002:a62:1ec5:: with SMTP id e188mr78665009pfe.242.1558331911977; Sun, 19 May 2019 22:58:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzshblQqEcw10KgQiW7hjXXeehaPNSZ1qRWLvHDxoQ9C5bcVEt8sAdCkc41M0e95rNO7OG9 X-Received: by 2002:a62:1ec5:: with SMTP id e188mr78664954pfe.242.1558331911108; Sun, 19 May 2019 22:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558331911; cv=none; d=google.com; s=arc-20160816; b=r68Qd+g38O7/aLnwp5u4ZnYKAirP37bV2Npjg5L3ld+YrcZhN4r57zz2AA9AV57Zca dl5G/tcF+R9fe6BTn8edEipf7cu+mzbEzhAuVObiNqQmgB7yPd8gNu6Q10lUkqJ/HqGI z6tjPjO/wMO5DeyhjgYYSFDXBdUgCmSEiGPxvwk3XPOV6MqahxVYKqpuZ4f0Hc+DmODK VrKGLpOsJlLYPsNSORoyQmTzc09FQVGzejYwfsTzjR5ZzvesymQP4Ry7ladMNrkM8BeI +Wn98UhojfAxaI73Bj9xAHQIOZdERG43PC4MmGRny50sfFkTu6xr0vpVKQzMp5r90Vry tgzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=MsXW1oUHr05ZSy88t0Z7I0GXKd9SSvBG18rggV2Vu2g=; b=UvHActoddzrf4lPtNsQb9QdYyrDVwacM1pK3EULdNngCGXUvu1LoaVbYrQ/8wf1D2l W6C3WsSA27otKddM3IP9C7WoADyCQXORhzk8ExMIw+2d2Pl0qxnWRaQApX46KYnr0Spl 5dxRH2BmHjdGkFqE34ovCqtvIAHYTpF5/OcLvzTQ2AeUAVNvUpaxw1rRk9xJbOMBGzBy wOJr+mHYi8GFNGwxoul9dIzl0Fe8jyEHx8ABbpxp3CMbDMdjCtkaBp5H0dNv9QcmwM1N J//65zszRwUaDtYJSS2erL6HFDNemeWuJDb2vW7ll80PlBYi+BGPrtVEZO7Zjnz1kfl0 6vQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=Y8rXbybl; spf=pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id r21si9056086pls.151.2019.05.19.22.58.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 May 2019 22:58:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=Y8rXbybl; spf=pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MsXW1oUHr05ZSy88t0Z7I0GXKd9SSvBG18rggV2Vu2g=; b=Y8rXbybloiYAZIahaVSujAokhz 2Yi2UAMOUpPcvHfhuSHLQu4Juf5a1UAxTglQmGxVdyniHxS24VDy1xVzAnQsKm5k9Im81PSFPeMCp iR6c10H9cNGjTJJiTzM27ZW02nvJmYAMVOBAM7TdgvrB0NJW+fWgdreJcQhRt/7/ftrttcvqetx1U rWn7x9w7HZ9lj9cm3tviyv3JE/7gPR54vNFSwecekAofc7b1GzqZusqzQqbRLZWj8a2q4yV66IyoI msf9FbMvBh8VtCYc1ERTpXzsAPWMHbYvaqX210fg7ZdbKDzr92R1HS8AHgaIZExx/0OSOcra4N6Tg eHYmr0TQ==; Received: from 089144206147.atnat0015.highway.bob.at ([89.144.206.147] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSbJa-0006Eo-Oh; Mon, 20 May 2019 05:58:28 +0000 From: Christoph Hellwig To: Andrew Morton Cc: Sami Tolvanen , Kees Cook , Nick Desaulniers , linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] mm: fix an overly long line in read_cache_page Date: Mon, 20 May 2019 07:57:28 +0200 Message-Id: <20190520055731.24538-2-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520055731.24538-1-hch@lst.de> References: <20190520055731.24538-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- mm/filemap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index c5af80c43d36..6a8048477bc6 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2862,7 +2862,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 Mon May 20 05:57:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10949959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60B9E912 for ; Mon, 20 May 2019 05:58:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52B8C285C5 for ; Mon, 20 May 2019 05:58:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46BBE2864E; Mon, 20 May 2019 05:58:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA0EC285C5 for ; Mon, 20 May 2019 05:58:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E28FF6B027A; Mon, 20 May 2019 01:58:37 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DDA746B027C; Mon, 20 May 2019 01:58:37 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF00C6B027D; Mon, 20 May 2019 01:58:37 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 994326B027A for ; Mon, 20 May 2019 01:58:37 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id j1so9240643pff.1 for ; Sun, 19 May 2019 22:58:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=rcaOtmTyxwSnzPPNQ/axvrfybs4dWe6fVXdJWykZd68=; b=QAz9ZUoz6Yzd3na59oUQ16bd3pZ+8h/G7G98Nm8/VWjMPD3Km+873qAkB8rvWfNAVt j1cVCkjGzuCjERj/2ueeCEiL/xVD25NAWltyR5JgY48PbuqIMIviqkRg4mkwqaMHL2sx BSkngSU3JbihMfMY7bsEpagSFrpwgKjm5wug1LMhZ0JNz4tH6az1R2sioQ0xLJRfDsI8 RGDgbEOYJiO1MWC3mNvZvPnCBxbTIEWuXkvXj1Euur/SudkfIEy9GJ4vXMooheOmYwoR jFYshG9X/COz0tBNHDIHYjO3PTzk6a+QQBkl0jcy0Bl/txIWOUD6bk1a6t3XUsbX2Ua9 KCHA== X-Gm-Message-State: APjAAAW98EUPeejJDueDYVMzYvsLY4CpgYdTpardzWSdSmx6jNpwz9VT Bya+/vsAEynviKL/FjoaCOJY0n+ScrcVwf3xpUO9IoB/6sOpD/qzQcH0kAlhVe8uW/q2EwWFOpO dnMzuhwRAaHfsxi/QvbRvU+2w2rvUQiWPT4PZbOZzeyocVGheqHrWcHg56l5xmaQ= X-Received: by 2002:a63:804a:: with SMTP id j71mr74284395pgd.68.1558331917298; Sun, 19 May 2019 22:58:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxguCvBaGTywQmD3gRyxU9uuzTGdcgODqFd9NeLF0QjuYwydSQGOLfDBNBMEGbVs6d4ksWZ X-Received: by 2002:a63:804a:: with SMTP id j71mr74284353pgd.68.1558331916653; Sun, 19 May 2019 22:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558331916; cv=none; d=google.com; s=arc-20160816; b=wAgAxvdPNhvYmQ1w3MBEmVD7tm/V62I6nSBFdRCp/f2E/M8LU8cxLJsVxIg+ObcweK zdvSul1c98VYUEjSni9m6Uewx1BjabVaOCjAq5BxCfi7enjqLPDFNUKWc8TB6aIbth4g bVt+fY7ouzS3oWDx+qrmufMdtqRopo4bRNpKDLnY7sgWo687rJROfjjdzNbzfig9e0Hs DEkh8OQAt5379O8xxMQHZm8CUmFmTWyUZ49afl1j4YQnSnIBO77Z4yixWvjOyh7c2dnL zdi7LOet9Mo8pr1CjH+1C88ju/BuopUQZgOKkGG4LP4OQvI6wlZ123FKD6f37657Ew41 4dRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=rcaOtmTyxwSnzPPNQ/axvrfybs4dWe6fVXdJWykZd68=; b=o5K3pgxX+1fxsfSTe+WOSzKAiFak1PZCS7A68SGu21stl9Pl9W5rQn21m5/ijhtxjC 6qAsmis2Kwt4U8rBppKpy/6u2CZtZAGiJ6S+wb5KzctWQWKqsTYleKauIJMLotVlxPvB wJf0vdGUECGjzh80Fu5pniWhEEgdJPzV9olVkgYVZAJ3OHYRuaovPHZpQlX/0kDGC4Jq M3Zx7w2jQvTm6TR14bOR8xomtPrHsfEXKR/qf/eQc+bUL8jATUK8YvoXVLWfy7/2yjDb ljePIyy614uAcWC+6z7R68ShzDZRuegShTbGnBDrvHVa666XDtD3eUZFf9PFjEBCsoyB nBBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=TKZaPqvg; spf=pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id i189si18309643pfb.41.2019.05.19.22.58.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 May 2019 22:58:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=TKZaPqvg; spf=pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rcaOtmTyxwSnzPPNQ/axvrfybs4dWe6fVXdJWykZd68=; b=TKZaPqvgbKWe2FRLJA63Rp5Va4 EtvOO4vybw2xssgKukZXhNdAQkCvd0y1IE51VR6M7TTOcm6DLHU2qbgUwi6nPchdxoG4tGd5VhFj7 9yybQfAzQmIjw22SU7R09kbrt8RnT/FngobcNa5wKjOlKMJ3XzkXclUBNGYSdK+al7cntGX2uvwNL eRifDrk6y+rx14GKPJO3SZblI7ry/8uTGUm2VZ3m6UDmQq12v2Y/7CyJiQUeU8OHnGXUxmfYvyuvG l1BG/wqrcj3QlYZP4pV6fuYRhD8W8fO60c9YZw65wHlm783Vt9UblIP7bahz++F6NgG2/U8i5iEi6 YTclvUgQ==; Received: from 089144206147.atnat0015.highway.bob.at ([89.144.206.147] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSbJe-0006FV-Qn; Mon, 20 May 2019 05:58:31 +0000 From: Christoph Hellwig To: Andrew Morton Cc: Sami Tolvanen , Kees Cook , Nick Desaulniers , linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] mm: don't cast ->readpage to filler_t for do_read_cache_page Date: Mon, 20 May 2019 07:57:29 +0200 Message-Id: <20190520055731.24538-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520055731.24538-1-hch@lst.de> References: <20190520055731.24538-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Kees Cook --- 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 9ec3544baee2..6dd7ec95c778 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -396,8 +396,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 6a8048477bc6..3bec6e18b763 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2772,7 +2772,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); @@ -2884,9 +2888,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 Mon May 20 05:57:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10949963 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDBD16C5 for ; Mon, 20 May 2019 05:58:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDCBF28179 for ; Mon, 20 May 2019 05:58:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1F70285C3; Mon, 20 May 2019 05:58:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5279128630 for ; Mon, 20 May 2019 05:58:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 59D3C6B027C; Mon, 20 May 2019 01:58:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 54E7F6B027E; Mon, 20 May 2019 01:58:42 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43D0F6B027F; Mon, 20 May 2019 01:58:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id 094A76B027C for ; Mon, 20 May 2019 01:58:42 -0400 (EDT) Received: by mail-pf1-f200.google.com with SMTP id t1so9231346pfa.10 for ; Sun, 19 May 2019 22:58:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=s0uOtVt2IyE4cfR/Y0SEBdScE54aOmbj3l250cgaAfI=; b=HEH+u9rrmlzsDZd6SpaRmdAjeXHzcHBAt/a0KPQujU45FOgcpxGNq7FuM8gWAUVmvw V9sJy9ltNtgrOFMJUDbkhAA6fQRH//COY2oT0SiRVCenyg9x2lddql0SFKpJfEapTEHD FrA47j0IkSI9W3342mNbmzVhHiQtpdVSCoTxFd4cTNlFyJs0LFKrsR6G1MhNqbyvge/0 GRilF2/CiTN8KxrH+LsIVdsNgFA7tRjSUqLiuGDSmFd6Y0nyBl49FSjUXSFTSolpj2WP OuuIpPDwKBCHec/JIzFJCqbIeuHTkaSr+fZrpdh8Acg8WluGpMuyV4VX48Bhkq4AlgYE WsRQ== X-Gm-Message-State: APjAAAWf+VDGhPBnmR8kHX2S5tQXokY3eBDsbmVCQOn5cuAn8VT0zyql YaKVs6YV1WlJKaumGTed5gSex62XIWkFbjZt6Tgsl4DJiiL9lqltmQeTJ95VIevnq3f6VX9rTDT k2SCul2QsJ6S/W813vG4w7niJLnPKEG7WQAg8dl/2iAzayKYwZwTiLr8vYzzZJtE= X-Received: by 2002:a63:ee10:: with SMTP id e16mr67840927pgi.207.1558331921702; Sun, 19 May 2019 22:58:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGicCJBIuXMf3G+QDzyrgTO8thgKf82KTGMxzqEJzZughRdVPfJbCa+zZ+nkSeJZd7B+hn X-Received: by 2002:a63:ee10:: with SMTP id e16mr67840868pgi.207.1558331920687; Sun, 19 May 2019 22:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558331920; cv=none; d=google.com; s=arc-20160816; b=oGM+pwKeounkRJCbOJLibgXZqgzPBHN91Gs2RonY7VWrYR1l2RkvmBLDeZTpKfFxZC qpzLrUD6Upgoa+zhc2L7U9lPYNYlRTaRm02x6hWjMudAChl+RyiAuBdcrC77mD0MHuUv 0mHDbYRehKyoF2GDXqyQ11M4Rz66Zum1Lgt0uQSfmBVnGK+UNuicSnO3MON0ZAWhl6c5 W6vu3qV8puc2OT4PVb/juiQ0I2JJb226VsyiPuRydToFIM26kCtdGLbBBMc3IWHbVwe4 Lh/HdQhlYdSsLLfkSB5sFVKrGkhhEiSEvCVF4w+i5897N9NimjDZolZRBMyqpb3DMUIG 369g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=s0uOtVt2IyE4cfR/Y0SEBdScE54aOmbj3l250cgaAfI=; b=zepgsmRAzHE27NP76y0zR53U3ixTpfHBCSgB9ATWVpwnhd2huNUNQqvQZPu/DykQa+ jfl2OLJxoLZQXBV5kTYXQYWDtEEwo1bVxM1VDTP2iiLI5JTTOlVel9rkPhZL7XYThN1q R0dp3lIA/L0i2ZglbcyYsxkpT3emdj/5Fm4b/MX6hBcl3aXWU1U4C3vxUBbf68Gjc0M5 XBsKerKI4TI0j3BMXMfTZWsrOrZsBsibZUl3NxioG/Qaj4kVW0f5hDIj8xF22pD2nb8R r+ZZtpypc8d4yiAA0wVhUfypFXuDTdc/xXaW7dWBbb6cC7N9d23kSnjPAEkDiITe9oOf RrBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=TjdrOaCy; spf=pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id 21si17386734pgv.410.2019.05.19.22.58.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 May 2019 22:58:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=TjdrOaCy; spf=pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=s0uOtVt2IyE4cfR/Y0SEBdScE54aOmbj3l250cgaAfI=; b=TjdrOaCygaa/v3jG/wHnMz3jBW n24bEiQWWQaZjA+YPHfrxSijLYaBE8PmAGLyk+L0ae7WI+QX+gWOG+vRGMllV8nU/BakVdpXQuN3f d7vkmkFg1o0zgdfvGXmGVHk9PdY9RyTPk1qJ4jKCNShwL1s1SbM+ojVnVPyNQ7CxDJuDeXaGrA3IE 2BqmX/79Rxk8tY/OI3mMEIH5wfsc81P6NnVKbBCmNBswsu9SZ/6Jd7XjzZ9dvpaAZigb54nKDwvmF QmUm+6sft6TWtT6DiMAJysavX4ZHQxyQrp7AB38L4VAl85fWA3casXlj+6TBedfIqOCXX7QmriJhj Nrz0y9Zg==; Received: from 089144206147.atnat0015.highway.bob.at ([89.144.206.147] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSbJh-0006Js-Q9; Mon, 20 May 2019 05:58:34 +0000 From: Christoph Hellwig To: Andrew Morton Cc: Sami Tolvanen , Kees Cook , Nick Desaulniers , linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] jffs2: pass the correct prototype to read_cache_page Date: Mon, 20 May 2019 07:57:30 +0200 Message-Id: <20190520055731.24538-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520055731.24538-1-hch@lst.de> References: <20190520055731.24538-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Kees Cook --- 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 112d85849db1..8a20ddd25f2d 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c @@ -687,7 +687,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 Mon May 20 05:57:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10949967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D377D6C5 for ; Mon, 20 May 2019 05:58:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4D4328649 for ; Mon, 20 May 2019 05:58:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B91E0285C3; Mon, 20 May 2019 05:58:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C065028653 for ; Mon, 20 May 2019 05:58:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1BB36B027E; Mon, 20 May 2019 01:58:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id ACBDB6B027F; Mon, 20 May 2019 01:58:42 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 994A26B0281; Mon, 20 May 2019 01:58:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id 643F66B027F for ; Mon, 20 May 2019 01:58:42 -0400 (EDT) Received: by mail-pg1-f200.google.com with SMTP id 123so9029371pgh.17 for ; Sun, 19 May 2019 22:58:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/SFfD7/IVWCGE96J1VVwYbb2NenGrtf57wS4zCUzGX8=; b=dRHqVGQeF3EaKH3psaYx8SA09NYHiJfODwh5OwiIKPxXVyR27jjfxM188jRXWOezCP iISEgTw9Fcp6hP3xcaIyIF8ePpMTHwCiIDtP7IK5w+V1Vws6qq9txtQoIUeoTOM137Fq 6+Hzmf8BtNbCH5yLDdCup6lE9hKPlwZHfEoSTzRxS+ajomjBsWidJqntdBoGv/r6HalX PejrL6I38uvdEeoBL8KM6/7P0RuFEAhT1Yh9vUOHNFhf5ie7LsGt+YKIRm/9ZQy+sCXy Gnl0r5UOsEJrMrnGsoZqV/Gf+wnKeg89GVqheaAnfwuL9JcieqGbORXN6L0TKr4pJ+66 N6Fg== X-Gm-Message-State: APjAAAWS8KLuvnajnPDZ7V/Divj3YEoPkmQ0ESUUxaoD6rbRFyRT1Esd YLirUs1dn2lA2giMLDKOFzE1C8ckd4pLM1yyY7BGWP0fXw06OJi6od8H9uTXonJukbz5Gy+IbHz ec+6STpTC8D/5LMErF3Hm1fD9LWmhZOt32HzzOT2xS8GJZrs7XKXi7yBQf4qO/q4= X-Received: by 2002:a63:295:: with SMTP id 143mr73188091pgc.279.1558331922006; Sun, 19 May 2019 22:58:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGQeTezAPX3PBSHm4e8PxzbnAt/bfuZUFiF31LmXR9vuyRFi+HBkneM9P5txPtmBL72SGC X-Received: by 2002:a63:295:: with SMTP id 143mr73188036pgc.279.1558331921118; Sun, 19 May 2019 22:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558331921; cv=none; d=google.com; s=arc-20160816; b=Y7pQQnNUmGgjiJSokDBQyqaeOXDOv7PPGiLut0r34fHkA3ieNBBk+tlWFpU6dWq8s7 XEzHJ9iK9rMnfO+07PSAw2sx6OyJDBhghbBRT49GIillIu2gG/vVT3I8GWIkZHz2Zeva wP+AQyUwVeFhqnlYgmAfQacRalQ2Je704i5wu1eXHeYl3xxcE0L8w70viZ30X9VFrel+ zE2EhZ8qhGm9hDVjpgAayQT/6+XX0E2WSVNQTlpMYgs51yWVbjKgrKru0nMLa1z8HvEY Sq/vc5OT5kKQMYnxEgC6p650ET+rN0BhsqafKBOJ0XsB2BTExFqnJ6ypIsLhng/VlWif 83VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=/SFfD7/IVWCGE96J1VVwYbb2NenGrtf57wS4zCUzGX8=; b=pbTEF8vCPZykFd1ZcC/D7yR4Ac/Vr0WFEHk0UFfVsEwX4l0vmBtQDUEhzlWVOttgyN riTkOdCKJIOWkwZvM2XyqBbZpXB9TbG4k/yqN1W4IfAs2aq0n863pcEcVgQ90qQJ2oV9 1enBCgpCC3CgRGN6hutcuN9EKiTueNuyajbKtPH1MlmOyVfiklCgXLAeG1JctkVAP/s/ 4Pu9CuQ9Y1j6fAONIY1X0ltYiYHYQVDR/H0rGHj2wyGDgesok5tUdoydlk1X6boVc3kr aWjuvm6b+AynE3AfsQsUWupfPt9cx+kAbrHwzkK3Ts+GmzEWVM6CP+vt/KeNp+EF5XA9 oynQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=Re+W8BLv; spf=pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id a24si16199268pls.372.2019.05.19.22.58.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 May 2019 22:58:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=Re+W8BLv; spf=pass (google.com: best guess record for domain of batv+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+dfc7240828d5493a4f00+5748+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/SFfD7/IVWCGE96J1VVwYbb2NenGrtf57wS4zCUzGX8=; b=Re+W8BLvyS1MgoCaapd/OQ+Qwp 32OBEnKBUJVLUs79jLWSzcz1kHXXyHyqcMTdwGtaPVC5xmto+sVBQqgTMzAmuURhrbIYp8FMJ3gfE l3oWMhBHjJ1yeMW3XRT+kjUL9TCBoASPc1/DwkGws7eiwnp5uHSqneVFr2IX7JFO6do7L/tWTt1Q+ +1pQd6hkn/MqT1RLnUTMwmXA4zOT9ItdA7hEcyB2tI29txo7KqHzqzpwDpAxhlqolJNjYlR1BOTTP Rkr/aD1nXh8ArmcikMSKICnWHj9XOcYz83RSs2HQrN6nrBvWm4RnQPggas+3xP5hz8S/E4U4lAclU hLiQL/ZA==; Received: from 089144206147.atnat0015.highway.bob.at ([89.144.206.147] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSbJk-0006OG-Cl; Mon, 20 May 2019 05:58:36 +0000 From: Christoph Hellwig To: Andrew Morton Cc: Sami Tolvanen , Kees Cook , Nick Desaulniers , linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] 9p: pass the correct prototype to read_cache_page Date: Mon, 20 May 2019 07:57:31 +0200 Message-Id: <20190520055731.24538-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520055731.24538-1-hch@lst.de> References: <20190520055731.24538-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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: Kees Cook --- 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; }