From patchwork Mon Nov 2 16:14:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 57047 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA2G41db001120 for ; Mon, 2 Nov 2009 16:04:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755236AbZKBQDy (ORCPT ); Mon, 2 Nov 2009 11:03:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755258AbZKBQDy (ORCPT ); Mon, 2 Nov 2009 11:03:54 -0500 Received: from mail-ew0-f228.google.com ([209.85.219.228]:50127 "EHLO mail-ew0-f228.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755236AbZKBQDy (ORCPT ); Mon, 2 Nov 2009 11:03:54 -0500 Received: by ewy28 with SMTP id 28so4978551ewy.18 for ; Mon, 02 Nov 2009 08:03:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=beL56GG7erJsejhJQdrt15JnuQ7txbUZq65mwLqslxE=; b=E/7ii9Pr/aSCzvGBP8JbscOvsiXaPCYWErqCsOSldZ0Q/2jKRmERu2Jk+hRuIVjJa8 ddHb9KoWS+ZRZ+X5fv3+NnS3NGa22dVMMzZsxJq9oUSLCZkC0lqdFOze8SM6T2TOb0v7 q6RIPz+HXRCt5NEGvRxECr/3VTptxW6941csw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=U3irtm6mPcjG6TxjLz61/zQGK1g5RgF75Av2hn9w4A1cwQI6viQe3vMnfjXElur4nQ liwi5hHhwLMkeWASG5aTU7npFP8g2ZbIsKCTQTvGPUciKHW56wDdqrGe1KB3fchRq9gm hHOYPIdBxUPxE10mXKCgdw/tiL7zBJKYZ1mPI= Received: by 10.216.87.203 with SMTP id y53mr4745137wee.177.1257177837509; Mon, 02 Nov 2009 08:03:57 -0800 (PST) Received: from zoinx.mars (vpn-144-28.vpn.uva.nl [146.50.144.28]) by mx.google.com with ESMTPS id 23sm4868432eya.12.2009.11.02.08.03.44 (version=SSLv3 cipher=RC4-MD5); Mon, 02 Nov 2009 08:03:50 -0800 (PST) Message-ID: <4AEF0572.9020609@gmail.com> Date: Mon, 02 Nov 2009 17:14:42 +0100 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: Paul Mundt , linux-sh@vger.kernel.org, Andrew Morton , LKML Subject: [PATCH] sh: Make sure indexes are positive Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c index 566e69d..f663c14 100644 --- a/arch/sh/boards/mach-highlander/setup.c +++ b/arch/sh/boards/mach-highlander/setup.c @@ -384,7 +384,7 @@ static unsigned char irl2irq[HL_NR_IRL]; static int highlander_irq_demux(int irq) { - if (irq >= HL_NR_IRL || !irl2irq[irq]) + if (irq >= HL_NR_IRL || irq < 0 || !irl2irq[irq]) return irq; return irl2irq[irq]; diff --git a/arch/sh/boards/mach-r2d/irq.c b/arch/sh/boards/mach-r2d/irq.c index c70fece..78d7b27 100644 --- a/arch/sh/boards/mach-r2d/irq.c +++ b/arch/sh/boards/mach-r2d/irq.c @@ -116,7 +116,7 @@ static unsigned char irl2irq[R2D_NR_IRL]; int rts7751r2d_irq_demux(int irq) { - if (irq >= R2D_NR_IRL || !irl2irq[irq]) + if (irq >= R2D_NR_IRL || irq < 0 || !irl2irq[irq]) return irq; return irl2irq[irq]; diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c index 9b784fd..6c52444 100644 --- a/arch/sh/mm/numa.c +++ b/arch/sh/mm/numa.c @@ -60,7 +60,7 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) unsigned long bootmem_paddr; /* Don't allow bogus node assignment */ - BUG_ON(nid > MAX_NUMNODES || nid == 0); + BUG_ON(nid > MAX_NUMNODES || nid <= 0); start_pfn = start >> PAGE_SHIFT; end_pfn = end >> PAGE_SHIFT;