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: <163250390413.2330363.3248359518033939175.stgit@warthog.procyon.org.uk>
Date:   Fri, 24 Sep 2021 18:18:24 +0100
From:   David Howells <dhowells@...hat.com>
To:     willy@...radead.org, hch@....de, trond.myklebust@...marydata.com
Cc:     Jens Axboe <axboe@...nel.dk>,
        "Darrick J. Wong" <djwong@...nel.org>, linux-xfs@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
        dhowells@...hat.com, dhowells@...hat.com, darrick.wong@...cle.com,
        viro@...iv.linux.org.uk, jlayton@...nel.org,
        torvalds@...ux-foundation.org, linux-nfs@...r.kernel.org,
        linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH v3 3/9] mm: Make swap_readpage() void

None of the callers of swap_readpage() actually check its return value and,
indeed, the operation may still be in progress, so remove the return value.

Signed-off-by: David Howells <dhowells@...hat.com>
cc: Matthew Wilcox <willy@...radead.org>
cc: Christoph Hellwig <hch@....de>
cc: Jens Axboe <axboe@...nel.dk>
cc: Darrick J. Wong <djwong@...nel.org>
cc: linux-xfs@...r.kernel.org
cc: linux-fsdevel@...r.kernel.org
cc: linux-mm@...ck.org
---

 include/linux/swap.h |    2 +-
 mm/page_io.c         |   11 +++--------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/include/linux/swap.h b/include/linux/swap.h
index 576d40e33b1f..293eba012d4f 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -416,7 +416,7 @@ extern void kswapd_stop(int nid);
 #include <linux/blk_types.h> /* for bio_end_io_t */
 
 /* linux/mm/page_io.c */
-extern int swap_readpage(struct page *page, bool do_poll);
+void swap_readpage(struct page *page, bool synchronous);
 extern int swap_writepage(struct page *page, struct writeback_control *wbc);
 int __swap_writepage(struct page *page, struct writeback_control *wbc);
 extern int swap_set_page_dirty(struct page *page);
diff --git a/mm/page_io.c b/mm/page_io.c
index afd18f6ec09e..b9fe25101a39 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -352,10 +352,9 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc)
 	return 0;
 }
 
-int swap_readpage(struct page *page, bool synchronous)
+void swap_readpage(struct page *page, bool synchronous)
 {
 	struct bio *bio;
-	int ret = 0;
 	struct swap_info_struct *sis = page_swap_info(page);
 	blk_qc_t qc;
 	struct gendisk *disk;
@@ -382,15 +381,13 @@ int swap_readpage(struct page *page, bool synchronous)
 		struct file *swap_file = sis->swap_file;
 		struct address_space *mapping = swap_file->f_mapping;
 
-		ret = mapping->a_ops->readpage(swap_file, page);
-		if (!ret)
+		if (!mapping->a_ops->readpage(swap_file, page))
 			count_vm_event(PSWPIN);
 		goto out;
 	}
 
 	if (sis->flags & SWP_SYNCHRONOUS_IO) {
-		ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
-		if (!ret) {
+		if (!bdev_read_page(sis->bdev, swap_page_sector(page), page)) {
 			if (trylock_page(page)) {
 				swap_slot_free_notify(page);
 				unlock_page(page);
@@ -401,7 +398,6 @@ int swap_readpage(struct page *page, bool synchronous)
 		}
 	}
 
-	ret = 0;
 	bio = bio_alloc(GFP_KERNEL, 1);
 	bio_set_dev(bio, sis->bdev);
 	bio->bi_opf = REQ_OP_READ;
@@ -435,7 +431,6 @@ int swap_readpage(struct page *page, bool synchronous)
 
 out:
 	psi_memstall_leave(&pflags);
-	return ret;
 }
 
 int swap_set_page_dirty(struct page *page)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ