public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Steven Whitehouse <swhiteho@redhat.com>,
	David Teigland <teigland@redhat.com>
Cc: cluster-devel@redhat.com, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [patch] gfs2: make some sizes unsigned in set_recover_size()
Date: Wed, 4 Jan 2012 10:19:31 +0300	[thread overview]
Message-ID: <20120104071931.GC30978@elgon.mountain> (raw)

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++) {

             reply	other threads:[~2012-01-04  7:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04  7:19 Dan Carpenter [this message]
2012-01-04 15:42 ` [patch] gfs2: make some sizes unsigned in set_recover_size() David Teigland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120104071931.GC30978@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=cluster-devel@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swhiteho@redhat.com \
    --cc=teigland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox