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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1432817572-5976-1-git-send-email-hofrat@osadl.org>
Date:	Thu, 28 May 2015 14:52:52 +0200
From:	Nicholas Mc Guire <hofrat@...dl.org>
To:	Tim Waugh <tim@...erelk.net>
Cc:	linux-kernel@...r.kernel.org, Nicholas Mc Guire <hofrat@...dl.org>
Subject: [PATCH] paride/pcd: convert timeout with msecs_to_jiffies

API compliance scanning with coccinelle flagged:
./drivers/block/paride/pcd.c:547:16-18: use of msecs_to_jiffies probably
	preferable

Converting milliseconds to jiffies by "val * HZ / 1000" is technically
not a clean solution as it does not handle all corner cases correctly.
By changing the conversion to use msecs_to_jiffies(val) conversion is
correct in all cases.

Patch was compile tested with x86_64_defconfig + CONFIG_PARPORT=m
CONFIG_PARPORT_PC=m, CONFIG_PARIDE=m, CONFIG_PARIDE_PCD=m

Patch is against 4.1-rc5 (localversion-next is -next-20150527)

Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
---

Converted the HZ / 10 to msecs_to_jiffies(100) simply because it makes
it clear that its a value in jiffies - not sure if thats ok - its
technically not needed.

 drivers/block/paride/pcd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 3b7c9f1..7ff3a3c 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -544,11 +544,11 @@ static int pcd_reset(struct pcd_unit *cd)
 	write_reg(cd, 6, 0xa0 + 0x10 * cd->drive);
 	write_reg(cd, 7, 8);
 
-	pcd_sleep(20 * HZ / 1000);	/* delay a bit */
+	pcd_sleep(msecs_to_jiffies(20));	/* delay a bit */
 
 	k = 0;
 	while ((k++ < PCD_RESET_TMO) && (status_reg(cd) & IDE_BUSY))
-		pcd_sleep(HZ / 10);
+		pcd_sleep(msecs_to_jiffies(100));
 
 	flg = 1;
 	for (i = 0; i < 5; i++)
-- 
1.7.10.4

--
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