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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1494161245-5722-1-git-send-email-karim.eshapa@gmail.com>
Date:   Sun,  7 May 2017 14:47:25 +0200
From:   Karim Eshapa <karim.eshapa@...il.com>
To:     tytso@....edu
Cc:     arnd@...db.de, gregkh@...uxfoundation.org,
        linux-kernel@...r.kernel.org, Karim Eshapa <karim.eshapa@...il.com>
Subject: [PATCH] char: random: casting prevents missing calculations

Cast (long)jiffies and (long)state->last_time beacause
they tends to unsigned long. may cause a problem specially
when comparison happens (< 0).

Signed-off-by: Karim Eshapa <karim.eshapa@...il.com>
---
 drivers/char/random.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 0ab0249..f685e78 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1012,7 +1012,7 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
 
 	preempt_disable();
 
-	sample.jiffies = jiffies;
+	sample.jiffies = (long)jiffies;
 	sample.cycles = random_get_entropy();
 	sample.num = num;
 	r = &input_pool;
@@ -1025,7 +1025,7 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
 	 */
 
 	if (!state->dont_count_entropy) {
-		delta = sample.jiffies - state->last_time;
+		delta = sample.jiffies - (long)state->last_time;
 		state->last_time = sample.jiffies;
 
 		delta2 = delta - state->last_delta;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ