public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] gfs2: make some sizes unsigned in set_recover_size()
@ 2012-01-04  7:19 Dan Carpenter
  2012-01-04 15:42 ` David Teigland
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-01-04  7:19 UTC (permalink / raw)
  To: Steven Whitehouse, David Teigland
  Cc: cluster-devel, linux-kernel, kernel-janitors

ls->ls_recover_size is uint32_t so old_size and new_size should be
unsigned as well.  Otherwise a large value could count as a negative
and we could get past the "if (old_size >= max_jid + 1)" check by
mistake.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index 82c82d0..400d041 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -886,7 +886,8 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots,
 	struct lm_lockstruct *ls = &sdp->sd_lockstruct;
 	uint32_t *submit = NULL;
 	uint32_t *result = NULL;
-	int i, max_jid, old_size, new_size;
+	uint32_t old_size, new_size;
+	int i, max_jid;
 
 	max_jid = 0;
 	for (i = 0; i < num_slots; i++) {

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

end of thread, other threads:[~2012-01-04 15:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-04  7:19 [patch] gfs2: make some sizes unsigned in set_recover_size() Dan Carpenter
2012-01-04 15:42 ` David Teigland

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