drbd: fix test of unsigned in _drbd_fault_random()
authorRoel Kluin <roel.kluin@gmail.com>
Fri, 18 Dec 2009 11:38:11 +0000 (12:38 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 18 Dec 2009 11:38:11 +0000 (12:38 +0100)
rsp->count is unsigned so the test does not work.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
drivers/block/drbd/drbd_main.c

index 157d1e4343c23a957c751778cd7781cca1ee7833..c2594c137e65bbb496eb33387564f1ef961b4425 100644 (file)
@@ -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;