powerpc/numa: Avoid possible reference beyond prop. length in find_min_common_depth()
authorMilton Miller <miltonm@bga.com>
Thu, 8 Jan 2009 02:19:43 +0000 (02:19 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 11 Feb 2009 02:37:58 +0000 (13:37 +1100)
find_min_common_depth() was checking the property length incorrectly.
The value is in bytes not cells, and it is using the second entry.

Signed-off-By: Milton Miller <miltonm@bga.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/mm/numa.c

index 7393bd76d698406f85a70b423113c8e163afacae..e26d5e5c22bed922aab38fc5ccd42a821ef7f3af 100644 (file)
@@ -289,7 +289,7 @@ static int __init find_min_common_depth(void)
        ref_points = of_get_property(rtas_root,
                        "ibm,associativity-reference-points", &len);
 
-       if ((len >= 1) && ref_points) {
+       if ((len >= 2 * sizeof(unsigned int)) && ref_points) {
                depth = ref_points[1];
        } else {
                dbg("NUMA: ibm,associativity-reference-points not found.\n");