From patchwork Thu Jan 8 12:19:43 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milton Miller X-Patchwork-Id: 17343 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 47AF6DE881 for ; Thu, 8 Jan 2009 23:25:19 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from mercury.realtime.net (mercury.realtime.net [205.238.132.86]) by ozlabs.org (Postfix) with ESMTP id 3CCA3DE8E8 for ; Thu, 8 Jan 2009 23:19:45 +1100 (EST) Received: from miltonm.aip.bga.com (01-056.251.popsite.net [205.232.218.56]) by realtime.net (Realtime Communications Advanced E-Mail Services V9.2) with ESMTP id 230063858-1817707 for multiple; Thu, 08 Jan 2009 06:19:43 -0600 To: Benjamin Herrenschmidt From: Milton Miller Subject: [PATCH 4/4] powerpc: numa: avoid possible reference beyond property length in find_min_common_depth Date: Thu, 08 Jan 2009 06:19:43 -0600 X-Originating-IP: 205.232.218.56 Message-ID: <1231417183_141716@mercury.realtime.net> Cc: linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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 --- I'm not aware of any trees that are broken in this way, so backport not likely needed but easy to apply. Index: work.git/arch/powerpc/mm/numa.c =================================================================== --- work.git.orig/arch/powerpc/mm/numa.c 2009-01-05 05:08:10.000000000 -0600 +++ work.git/arch/powerpc/mm/numa.c 2009-01-05 05:10:25.000000000 -0600 @@ -260,7 +260,7 @@ static int __init find_min_common_depth( 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");