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]
Message-ID: <20210609070433.1323812-1-libaokun1@huawei.com>
Date:   Wed, 9 Jun 2021 15:04:33 +0800
From:   Baokun Li <libaokun1@...wei.com>
To:     <linux-kernel@...r.kernel.org>, Alasdair Kergon <agk@...hat.com>,
        "Mike Snitzer" <snitzer@...hat.com>, <dm-devel@...hat.com>
CC:     <weiyongjun1@...wei.com>, <yuehaibing@...wei.com>,
        <yangjihong1@...wei.com>, <yukuai3@...wei.com>,
        <libaokun1@...wei.com>, <kernel-janitors@...r.kernel.org>,
        Hulk Robot <hulkci@...wei.com>
Subject: [PATCH -next v2] dm writecache: use list_move instead of list_del/list_add in dm-writecache.c

Using list_move() instead of list_del() + list_add() in dm-writecache.c.

Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Baokun Li <libaokun1@...wei.com>
---
V1->V2:
	CC mailist

 drivers/md/dm-writecache.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index ea9f0d8fff1d..a809a616d691 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -1868,15 +1868,13 @@ static void writecache_writeback(struct work_struct *work)
 			if (unlikely(read_original_sector(wc, f) ==
 				     read_original_sector(wc, e))) {
 				BUG_ON(!f->write_in_progress);
-				list_del(&e->lru);
-				list_add(&e->lru, &skipped);
+				list_move(&e->lru, &skipped);
 				cond_resched();
 				continue;
 			}
 		}
 		wc->writeback_size++;
-		list_del(&e->lru);
-		list_add(&e->lru, &wbl.list);
+		list_move(&e->lru, &wbl.list);
 		wbl.size++;
 		e->write_in_progress = true;
 		e->wc_list_contiguous = 1;
@@ -1911,8 +1909,7 @@ static void writecache_writeback(struct work_struct *work)
 			//	break;
 
 			wc->writeback_size++;
-			list_del(&g->lru);
-			list_add(&g->lru, &wbl.list);
+			list_move(&g->lru, &wbl.list);
 			wbl.size++;
 			g->write_in_progress = true;
 			g->wc_list_contiguous = BIO_MAX_VECS;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ