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>] [day] [month] [year] [list]
Date:	Thu,  3 Dec 2015 22:22:07 +0800
From:	Geliang Tang <geliangtang@....com>
To:	Hugh Dickins <hughd@...gle.com>
Cc:	Geliang Tang <geliangtang@....com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] shmem: use list_for_each_entry_safe in shmem_unuse

Simplify the code with list_for_each_entry_safe().

Signed-off-by: Geliang Tang <geliangtang@....com>
---
 mm/shmem.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 9b05111..816685f 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -793,8 +793,7 @@ static int shmem_unuse_inode(struct shmem_inode_info *info,
  */
 int shmem_unuse(swp_entry_t swap, struct page *page)
 {
-	struct list_head *this, *next;
-	struct shmem_inode_info *info;
+	struct shmem_inode_info *info, *next;
 	struct mem_cgroup *memcg;
 	int error = 0;
 
@@ -818,8 +817,7 @@ int shmem_unuse(swp_entry_t swap, struct page *page)
 	error = -EAGAIN;
 
 	mutex_lock(&shmem_swaplist_mutex);
-	list_for_each_safe(this, next, &shmem_swaplist) {
-		info = list_entry(this, struct shmem_inode_info, swaplist);
+	list_for_each_entry_safe(info, next, &shmem_swaplist, swaplist) {
 		if (info->swapped)
 			error = shmem_unuse_inode(info, swap, &page);
 		else
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ