Skip to contentSkip to conversation

gfs2: make some sizes unsigned in set_recover_size()

PATCH In review Dan Carpenter 2 participants 2 messages Jan 4, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2: make some sizes unsigned in set_recover_size()

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.

fs/gfs2/lock_dlm.c +2 -1
index 82c82d0..400d041 100644
@@ -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++) {
#1 lore raw
Quoted 2 lines

[patch] dlm: le32 vs le16
gfs2: make some sizes unsigned in set_recover_size()

Thanks, I've folded in both of those.
Dave