Module Name: src
Committed By: matt
Date: Fri Jul 1 07:44:34 UTC 2011
Modified Files:
src/sys/arch/evbppc/mpc85xx: machdep.c
Log Message:
Fix some array bounds errors found by gcc 4.5
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbppc/mpc85xx/machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.15 src/sys/arch/evbppc/mpc85xx/machdep.c:1.16
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.15 Thu Jun 30 00:52:56 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c Fri Jul 1 07:44:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.15 2011/06/30 00:52:56 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.16 2011/07/01 07:44:33 matt Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -480,14 +480,16 @@
}
}
mr = physmemr;
- for (u_int i = 0; i < cnt; i++, mr++) {
+ for (u_int i = 0; i + 1 < cnt; i++, mr++) {
if (mr->start + mr->size == mr[1].start) {
mr->size += mr[1].size;
- for (u_int j = 1; j < cnt - i; j++)
+ for (u_int j = 1; i + j + 1 < cnt; j++)
mr[j] = mr[j+1];
cnt--;
}
}
+ } else {
+ panic("%s: no memory found", __func__);
}
/*