Skip to contentSkip to conversation

drbd: Fix test of unsigned in _drbd_fault_random()

PATCH In review Roel Kluin 2 participants 2 messages Dec 15, 2009 – Dec 21, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 drbd: Fix test of unsigned in _drbd_fault_random()

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

---
Found using coccinelle: http://coccinelle.lip6.fr/

drivers/block/drbd/drbd_main.c +1 -1
index 157d1e4..c2594c1 100644
@@ -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;
maintainer
#1 lore raw

Am Dienstag, 15. Dezember 2009 22:55:44 schrieb Roel Kluin:

Quoted 2 lines

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

Thanks. On its way upstream.

-Phil

Signature · 6 lines
: Dipl-Ing Philipp Reisner
: LINBIT | Your Way to High Availability
: Tel: +43-1-8178292-50, Fax: +43-1-8178292-82
: http://www.linbit.com

DRBD(R) and LINBIT(R) are registered trademarks of LINBIT, Austria.