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: <1448477535-5255-1-git-send-email-AmeenAli023@gmail.com>
Date:	Wed, 25 Nov 2015 20:52:15 +0200
From:	Ameen <ameenali023@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Ameen <AmeenAli023@...il.com>
Subject: [PATCH] Update ratelimit.c

fix a bug in ratelimit, if the "begin" doesn't update at the same time with printed
the print will start from 1 in loops except for the first time,
lets to only 9 logs suppressed, but not 10 as expected.

Signed-off-by : Ameen Ali <AmeenAli023@...il.com>
---
 lib/ratelimit.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index 40e03ea..7118ea7 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -42,14 +42,12 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
 	if (!raw_spin_trylock_irqsave(&rs->lock, flags))
 		return 0;
 
-	if (!rs->begin)
-		rs->begin = jiffies;
 
 	if (time_is_before_jiffies(rs->begin + rs->interval)) {
 		if (rs->missed)
 			printk(KERN_WARNING "%s: %d callbacks suppressed\n",
 				func, rs->missed);
-		rs->begin   = 0;
+		rs->begin   = jiffies;
 		rs->printed = 0;
 		rs->missed  = 0;
 	}
-- 
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