Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3129026ybi; Thu, 18 Jul 2019 21:35:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgMi7v13ugSkKgfMJRuQZ7fiVQNuHIJvGYo6siymE6PFxyXv1X4PVmUfgaxxvL0I0A6kM9 X-Received: by 2002:a17:902:a612:: with SMTP id u18mr52902685plq.181.1563510945699; Thu, 18 Jul 2019 21:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563510945; cv=none; d=google.com; s=arc-20160816; b=N2yX8pfwkclHVKikXSoG6gojdwxCuYdtWIN/V3PfyZX+ezOCCKwC0euQWWKKzlTvOH YR4YwggbM+7Etc3urD364gpu651JCBC6jmnjYufC0Ll4R60NyJMQJtdDhNjHUHBQvZ82 5Dfx+o2/upD+kbIOchD7KnXutIenLuD1i47h88jSzs4ciGZgFKy1fgSEyXDwvXK6koNe UBaHHuktchfCRW08ewra+j1uEiyoUqJiHfcusYdlbMYgaYw9OmrxC6QT6y8mKoZNxAvY SMla+ku8NiB7tZ0PfkzR2+FZWRZYx3DF6xoT6EgoeiadsGZ79aEZKv3dHNpumBJx1S5M uwxQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oZ8q6n9LqMHR/gD16YCnvnMxj2TYoU6tQTs5sSOcaho=; b=Rh3kPKEBKB9TWiea0+H9fz1ghX6wg8tSLOeHqpSk6+A9B8R5KjwpMBn+TIVP4reU4t LWECo+Fcz9bl0eqH0+83KIMW2QU0TaCmctHFt6l5yu5rOk8qWDKm/JPBZBJ6PitJzlIs pyI+HLjU2EmqTtdy1oKrg3P1XbwtgdTwKdkXDDqFgPt1Gmf/pNMlmnMEWmhMbYlMyzZJ zX0jfpuw6MtzcHQjWJQ3JZRrNyXAW63YXGZjw1YMya+sIHtwebbDiu3zQ+oNGTdl2Sx4 w0MmRkWgEEpaJKHtPkkCrfMAa7xt+0MX3QiIgkGsHfZLWCO3B0LbvMvFGXN11If7AGAU 6dow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JQSKNuJL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m45si643073pje.39.2019.07.18.21.35.30; Thu, 18 Jul 2019 21:35:45 -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=JQSKNuJL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730227AbfGSEe0 (ORCPT + 99 others); Fri, 19 Jul 2019 00:34:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:33708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729723AbfGSEB4 (ORCPT ); Fri, 19 Jul 2019 00:01:56 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7748E218B8; Fri, 19 Jul 2019 04:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508915; bh=AX73ikEry2voD9wFvV2u+EohCETcn1SCunXvxQ1Q/iM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JQSKNuJLYiTUdttgbHjCFM57pro8CPqICgCCnxH9IsrXsC8gM2/0Z1+su6lJi9x/s 1OQD4qMO6UtWGoccmF/v5pQAbk0TJz55BLXeSDAhykuTXGyBSY7eGH4s9cXSfSnJw/ vZypyNkYu5NEjTixxmmW5LsFAcX5U2yfOCEKNayw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christoph Hellwig , Kees Cook , Sami Tolvanen , Nick Desaulniers , Andrew Morton , Linus Torvalds , Sasha Levin , v9fs-developer@lists.sourceforge.net Subject: [PATCH AUTOSEL 5.2 157/171] 9p: pass the correct prototype to read_cache_page Date: Thu, 18 Jul 2019 23:56:28 -0400 Message-Id: <20190719035643.14300-157-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig [ 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 bc57ae9e2963..cce9ace651a2 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -35,8 +35,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; @@ -107,7 +108,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