All of lore.kernel.org
 help / color / mirror / Atom feed
* [Drbd-dev] [PATCH] drbd: Fix test of unsigned in _drbd_fault_random()
@ 2009-12-15 21:55 ` Roel Kluin
  0 siblings, 0 replies; 3+ messages in thread
From: Roel Kluin @ 2009-12-15 21:55 UTC (permalink / raw)
  To: drbd-dev, drbd-user, Andrew Morton, LKML

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.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;

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

* [PATCH] drbd: Fix test of unsigned in _drbd_fault_random()
@ 2009-12-15 21:55 ` Roel Kluin
  0 siblings, 0 replies; 3+ messages in thread
From: Roel Kluin @ 2009-12-15 21:55 UTC (permalink / raw)
  To: drbd-dev, drbd-user, Andrew Morton, LKML

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.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;

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

* Re: [Drbd-dev] [PATCH] drbd: Fix test of unsigned in _drbd_fault_random()
  2009-12-15 21:55 ` Roel Kluin
  (?)
@ 2009-12-21 16:12 ` Philipp Reisner
  -1 siblings, 0 replies; 3+ messages in thread
From: Philipp Reisner @ 2009-12-21 16:12 UTC (permalink / raw)
  To: drbd-dev; +Cc: Roel Kluin

Am Dienstag, 15. Dezember 2009 22:55:44 schrieb Roel Kluin:
> rsp->count is unsigned so the test does not work.
> 

Thanks. On its way upstream.

-Phil
-- 
: 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.

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-15 21:55 [Drbd-dev] [PATCH] drbd: Fix test of unsigned in _drbd_fault_random() Roel Kluin
2009-12-15 21:55 ` Roel Kluin
2009-12-21 16:12 ` [Drbd-dev] " Philipp Reisner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.