Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3790351ybi; Mon, 29 Jul 2019 12:40:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRQ9t0zmcAR3ABBRA5CLTpauicc3SjyJvDeFErVRpABdzGVjscPEeMrS8Y52MQwH6SVz3r X-Received: by 2002:a62:7994:: with SMTP id u142mr38790068pfc.39.1564429239715; Mon, 29 Jul 2019 12:40:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429239; cv=none; d=google.com; s=arc-20160816; b=ae6lys2XjugsKXacXqYYL3DKuBrTHzSsoHZ8UgSzm2NjO0/WXh0YXKsFdm8IlUaMHv q1GZ9VECyHEb4MuYWY0qRPMdWBJlipCJYkb81Gbg+oy2aEise1QupQVhc6Sk9aDsGv3r 9kKKeq8Lu/cbHI66libqwTmS4JVNOfaMU/lM1TEbZFyEYXCHSAVwrTcsTq2tMpyvwfRX Zxhhi5MJOPBhStao/FkLonjkN9+bE1M4vK1m+0aoxEbewAncqIoeW+zahke+3d81XW+b 2DWaCZs0os3qFHvHsX9Aa1G368sgILOcZN3IUvbDzSdnaKUgTnJZQd22yVHuGkRATtj+ Wotg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=osKZgMMEUpbTxD6EwcH/6SzuKUIksiTjZwNmjMXISlA=; b=LvZmu1C3MVih+HQHv4MD1TCiXv7dH9zOw4wY7YcySM981AWWOu35vwm81TxNIjhgcE ElmlmlmKHzf3NLU0956QCaJ22fo8w+WNcHhBhP5y/mZFn2LixHHAWZ9h7uYfrvLgj/Vw FKYbsaJ8KLEB9TR8O6I3u1eqH9D0/4O+gyC2Yi9d0gREf2bgucfrIdYxXWMClvLA4ZH+ z9/GQ5B2Mp6/YMEWCz4cubsdIK2LodKpLGlmOc1GzJ1R5iA7z3sr/+4zSFSdBUrfVnBV +Rg8mgkY6GlXUSuIoI5ec6e5QOzZOmkayoLaeEYI0QkX8hVq8HLVwEKYhoXNKXU+0sPI mT7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="uq9Z/enP"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x18si28838420plm.292.2019.07.29.12.40.24; Mon, 29 Jul 2019 12:40:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="uq9Z/enP"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388924AbfG2TjD (ORCPT + 99 others); Mon, 29 Jul 2019 15:39:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:53972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387909AbfG2Ti6 (ORCPT ); Mon, 29 Jul 2019 15:38:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 39F9A217D7; Mon, 29 Jul 2019 19:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429137; bh=ZeySQA67f8U0g3QtOJ+NqwzjKd7z3D+xJ9QnjPk48ZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uq9Z/enPvD69pj7fcHpxAmge6hrJJjN4ORPkqHpmDL2ejwpmzbALwoRJcxTQsdPG1 SbkIw4sFheoazYk4u9XzUwzTm96LcnEiRo/kBJbedRmFVKPnDux0euUANveclQMhll xSpIrDXHCA8xYDfI6e/A4ow7UhGKfyA87v2n7uIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Kees Cook , Sami Tolvanen , Nick Desaulniers , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 272/293] 9p: pass the correct prototype to read_cache_page Date: Mon, 29 Jul 2019 21:22:43 +0200 Message-Id: <20190729190845.170763501@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit f053cbd4366051d7eb6ba1b8d529d20f719c2963 ] 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. Link: http://lkml.kernel.org/r/20190520055731.24538-5-hch@lst.de Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook Cc: Sami Tolvanen Cc: Nick Desaulniers Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- 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 e1cbdfdb7c68..197069303510 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; } -- 2.20.1