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:   Fri, 26 Jan 2018 23:31:34 +0800
From:   Jia-Ju Bai <baijiaju1990@...il.com>
To:     axboe@...nel.dk, ming.lei@...hat.com, Bart.VanAssche@...disk.com,
        jthumshirn@...e.de, hare@...e.com, sagi@...mberg.me
Cc:     linux-kernel@...r.kernel.org, Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH 1/3] block: mtip32xx: Replace mdelay with msleep in mtip_hw_init

After checking all possible call chains to mtip_hw_init() here,
my tool finds that this function is never called in atomic context,
namely never in an interrupt handler or holding a spinlock.
And mtip_hw_init() calls kzalloc_node(GFP_KERNEL) that can sleep,
so it indicates that mtip_hw_init() can call functions that can sleep.
Thus mdelay can be replaced with msleep to avoid busy wait.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
---
 drivers/block/mtip32xx/mtip32xx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index b8af735..1d8ace6 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3069,7 +3069,7 @@ static int mtip_hw_init(struct driver_data *dd)
 	timeout = jiffies + msecs_to_jiffies(30000);
 	while (((readl(dd->port->mmio + PORT_SCR_STAT) & 0x0F) != 0x03) &&
 		 time_before(jiffies, timeout)) {
-		mdelay(100);
+		msleep(100);
 	}
 	if (unlikely(mtip_check_surprise_removal(dd->pdev))) {
 		timetaken = jiffies - timetaken;
-- 
1.7.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ