[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4B2805E0.2080304@gmail.com>
Date: Tue, 15 Dec 2009 22:55:44 +0100
From: Roel Kluin <roel.kluin@...il.com>
To: drbd-dev@...ts.linbit.com, drbd-user@...ts.linbit.com,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] drbd: Fix test of unsigned in _drbd_fault_random()
rsp->count is unsigned so the test does not work.
Signed-off-by: Roel Kluin <roel.kluin@...il.com>
---
Found using coccinelle: http://coccinelle.lip6.fr/
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 157d1e4..c2594c1 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -3623,7 +3623,7 @@ _drbd_fault_random(struct fault_random_state *rsp)
{
long refresh;
- if (--rsp->count < 0) {
+ if (!rsp->count--) {
get_random_bytes(&refresh, sizeof(refresh));
rsp->state += refresh;
rsp->count = FAULT_RANDOM_REFRESH;
--
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