Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] [patch 5/5] drbd: fix test of unsigned in _drbd_fault_random()
@ 2009-12-22  0:27 akpm
  2009-12-22  9:07 ` Philipp Reisner
  0 siblings, 1 reply; 5+ messages in thread
From: akpm @ 2009-12-22  0:27 UTC (permalink / raw)
  To: jens.axboe; +Cc: akpm, roel.kluin, philipp.reisner, drbd-dev

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

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>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@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;
_

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-22 21:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-22  0:27 [Drbd-dev] [patch 5/5] drbd: fix test of unsigned in _drbd_fault_random() akpm
2009-12-22  9:07 ` Philipp Reisner
2009-12-22  9:13   ` Jens Axboe
2009-12-22 17:22     ` Andrew Morton
2009-12-22 21:41       ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox