public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitriy Monakhov <dmonakhov@sw.ru>
To: Mingming Cao <cmm@us.ibm.com>
Cc: Alex Tomas <alex@clusterfs.com>, linux-ext4@vger.kernel.org
Subject: [PATCH] ext4:fix invariant checking in ext4_rebalance_reservation
Date: Sat, 16 Jun 2007 12:02:00 +0400	[thread overview]
Message-ID: <20070616080200.GA14349@localhost.sw.ru> (raw)
In-Reply-To: <1181949368.3808.7.camel@dyn9047017103.beaverton.ibm.com>

Variable "free" was declarated as __u64 so conidition (free < 0) always
false, even if free was overflowed during substraction.
---
 fs/ext4/balloc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 43ae8f8..a9655f1 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -1909,8 +1909,8 @@ void ext4_rebalance_reservation(struct ext4_reservation_slot *rs, __u64 free)
 			chunk = free;
 		if (rs[i].rs_reserved || i == smp_processor_id()) {
 			rs[i].rs_reserved = chunk;
+			BUG_ON(free < chunk);
 			free -= chunk;
-			BUG_ON(free < 0);
 		}
 	}
 	BUG_ON(free);
-- 
1.5.2

  reply	other threads:[~2007-06-16  8:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-14  7:23 delayed allocatiou result in Oops Dmitriy Monakhov
2007-06-15  5:14 ` Alex Tomas
2007-06-15 23:16   ` Mingming Cao
2007-06-16  8:02     ` Dmitriy Monakhov [this message]
2007-06-18 21:09       ` [PATCH] ext4:fix invariant checking in ext4_rebalance_reservation Mingming Cao
2007-06-19  5:56       ` Dmitry Monakhov
2007-06-16  8:14     ` delayed allocatiou result in Oops Dmitriy Monakhov
2007-06-19  1:01       ` Mingming Cao
2007-06-19  7:11         ` Alex Tomas
2007-06-19  9:16           ` Dmitry Monakhov
2007-06-19  9:36             ` Alex Tomas
2007-06-19 21:50             ` Andreas Dilger
2007-06-19 16:23           ` Mingming Cao
2007-06-19 16:47             ` Aneesh Kumar K.V
2007-06-20  8:15             ` Alex Tomas
2007-06-20 23:46               ` Mingming Cao
2007-06-21  4:50                 ` Dmitry Monakhov

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=20070616080200.GA14349@localhost.sw.ru \
    --to=dmonakhov@sw.ru \
    --cc=alex@clusterfs.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    /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