lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201007010603.3452458-4-jglisse@redhat.com>
Date:   Tue,  6 Oct 2020 21:05:52 -0400
From:   jglisse@...hat.com
To:     linux-kernel@...r.kernel.org
Cc:     Jérôme Glisse <jglisse@...hat.com>,
        linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Tejun Heo <tj@...nel.org>, Jan Kara <jack@...e.cz>,
        Josef Bacik <josef@...icpanda.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH 03/14] fs: directly use a_ops->freepage() instead of a local copy of it.

From: Jérôme Glisse <jglisse@...hat.com>

Coccinelle is confuse with function pointer, convert to directly
use a_ops->freepage() to be nice to coccinelle.

Signed-off-by: Jérôme Glisse <jglisse@...hat.com>
Cc: linux-fsdevel@...r.kernel.org
Cc: linux-mm@...ck.org
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Tejun Heo <tj@...nel.org>
Cc: Jan Kara <jack@...e.cz>
Cc: Josef Bacik <josef@...icpanda.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
---
 mm/filemap.c | 12 ++++--------
 mm/vmscan.c  |  7 ++-----
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 2cdbbffc55522..ba892599a2717 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -242,11 +242,8 @@ void __delete_from_page_cache(struct page *page, void *shadow)
 static void page_cache_free_page(struct address_space *mapping,
 				struct page *page)
 {
-	void (*freepage)(struct page *);
-
-	freepage = mapping->a_ops->freepage;
-	if (freepage)
-		freepage(page);
+	if (mapping->a_ops->freepage)
+		mapping->a_ops->freepage(page);
 
 	if (PageTransHuge(page) && !PageHuge(page)) {
 		page_ref_sub(page, HPAGE_PMD_NR);
@@ -790,7 +787,6 @@ EXPORT_SYMBOL(file_write_and_wait_range);
 int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
 {
 	struct address_space *mapping = old->mapping;
-	void (*freepage)(struct page *) = mapping->a_ops->freepage;
 	pgoff_t offset = old->index;
 	XA_STATE(xas, &mapping->i_pages, offset);
 	unsigned long flags;
@@ -819,8 +815,8 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
 	if (PageSwapBacked(new))
 		__inc_lruvec_page_state(new, NR_SHMEM);
 	xas_unlock_irqrestore(&xas, flags);
-	if (freepage)
-		freepage(old);
+	if (mapping->a_ops->freepage)
+		mapping->a_ops->freepage(old);
 	put_page(old);
 
 	return 0;
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 466fc3144fffc..6db869339073d 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -903,9 +903,6 @@ static int __remove_mapping(struct address_space *mapping, struct page *page,
 		xa_unlock_irqrestore(&mapping->i_pages, flags);
 		put_swap_page(page, swap);
 	} else {
-		void (*freepage)(struct page *);
-
-		freepage = mapping->a_ops->freepage;
 		/*
 		 * Remember a shadow entry for reclaimed file cache in
 		 * order to detect refaults, thus thrashing, later on.
@@ -928,8 +925,8 @@ static int __remove_mapping(struct address_space *mapping, struct page *page,
 		__delete_from_page_cache(page, shadow);
 		xa_unlock_irqrestore(&mapping->i_pages, flags);
 
-		if (freepage != NULL)
-			freepage(page);
+		if (mapping->a_ops->freepage != NULL)
+			mapping->a_ops->freepage(page);
 	}
 
 	return 1;
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ