[Drbd-dev] [patch 5/5] drbd: fix test of unsigned in _drbd_fault_random()

akpm at linux-foundation.org akpm at linux-foundation.org
Tue Dec 22 01:27:52 CET 2009


From: Roel Kluin <roel.kluin at gmail.com>

rsp->count is unsigned so the test does not work.

Signed-off-by: Roel Kluin <roel.kluin at gmail.com>
Cc: Lars Ellenberg <drbd-dev at lists.linbit.com>
Cc: Philipp Reisner <philipp.reisner at linbit.com>
Cc: Jens Axboe <jens.axboe at oracle.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
---

 drivers/block/drbd/drbd_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/block/drbd/drbd_main.c~drbd-fix-test-of-unsigned-in-_drbd_fault_random drivers/block/drbd/drbd_main.c
--- a/drivers/block/drbd/drbd_main.c~drbd-fix-test-of-unsigned-in-_drbd_fault_random
+++ a/drivers/block/drbd/drbd_main.c
@@ -3623,7 +3623,7 @@ _drbd_fault_random(struct fault_random_s
 {
 	long refresh;
 
-	if (--rsp->count < 0) {
+	if (!rsp->count--) {
 		get_random_bytes(&refresh, sizeof(refresh));
 		rsp->state += refresh;
 		rsp->count = FAULT_RANDOM_REFRESH;
_


More information about the drbd-dev mailing list