[tip:kmemcheck] kmemcheck: fix an incorrect BUG_ON()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Author:     Vegard Nossum <vegard.nossum@xxxxxxxxx>
AuthorDate: Sun, 22 Feb 2009 22:22:39 +0100
Commit:     Vegard Nossum <vegard.nossum@xxxxxxxxx>
CommitDate: Sun, 22 Feb 2009 22:22:39 +0100

kmemcheck: fix an incorrect BUG_ON()

This will BUG one too soon (when we reach 3 addresses instead of 4).
Move it in front of the increment. It also makes sense to test this
before actually saving any more addresses.

Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxx>


---
 arch/x86/mm/kmemcheck/kmemcheck.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
index a57dad9..aeefc64 100644
--- a/arch/x86/mm/kmemcheck/kmemcheck.c
+++ b/arch/x86/mm/kmemcheck/kmemcheck.c
@@ -131,9 +131,8 @@ static void kmemcheck_save_addr(unsigned long addr)
 {
 	struct kmemcheck_context *data = &__get_cpu_var(kmemcheck_context);
 
-	data->addr[data->n_addrs++] = addr;
-
 	BUG_ON(data->n_addrs >= ARRAY_SIZE(data->addr));
+	data->addr[data->n_addrs++] = addr;
 }
 
 static unsigned int kmemcheck_show_all(void)
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux