From patchwork Fri Apr 17 06:08:45 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 26111 X-Patchwork-Delegate: grant.likely@secretlab.ca Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id D1AF9B707A for ; Fri, 17 Apr 2009 16:09:31 +1000 (EST) Received: by ozlabs.org (Postfix) id 4B0A3DE425; Fri, 17 Apr 2009 16:09:18 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 49717DE423 for ; Fri, 17 Apr 2009 16:09:18 +1000 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.156]) by ozlabs.org (Postfix) with ESMTP id 026CFDE1A5 for ; Fri, 17 Apr 2009 16:08:48 +1000 (EST) Received: by fg-out-1718.google.com with SMTP id e21so316675fga.16 for ; Thu, 16 Apr 2009 23:08:46 -0700 (PDT) Received: by 10.86.27.19 with SMTP id a19mr1777415fga.22.1239948526787; Thu, 16 Apr 2009 23:08:46 -0700 (PDT) Received: from monstr.eu ([89.31.47.178]) by mx.google.com with ESMTPS id 12sm437867fgg.27.2009.04.16.23.08.45 (version=SSLv3 cipher=RC4-MD5); Thu, 16 Apr 2009 23:08:46 -0700 (PDT) Message-ID: <49E81CED.1000704@monstr.eu> Date: Fri, 17 Apr 2009 08:08:45 +0200 From: Michal Simek User-Agent: Thunderbird 2.0.0.18 (X11/20081120) MIME-Version: 1.0 To: linuxppc-dev Subject: Proposed prom parse fix + moving. Cc: ilpo.jarvinen@helsinki.fi, Arnd Bergmann X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: monstr@monstr.eu List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Hi All, I have got email from Ilpo about prom_parse file. I take this file from powerpc. Who did write prom_parse file and take care about? BTW: What about to move prom_parse file to any generic location as we discussed in past? Any volunteer? Thanks, Michal -------- Original Message -------- Subject: [RFC!] [PATCH] microblaze: fix bug in error handling Date: Thu, 16 Apr 2009 23:05:53 +0300 (EEST) From: Ilpo Järvinen To: monstr@monstr.eu CC: microblaze-uclinux@itee.uq.edu.au While some version of the patches were on the lkml I read some part of the code briefly through but my feedback got stuck into postponed emails, so here's one correctness related issue I might have found (the rest were just cosmetic things). I'm not sure if the latter return needs the of_node_put or not but it seems more likely than not. Not even compile tested. Signed-off-by: Ilpo Järvinen --- arch/microblaze/kernel/prom_parse.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/microblaze/kernel/prom_parse.c b/arch/microblaze/kernel/prom_parse.c index ae0352e..d1174bc 100644 --- a/arch/microblaze/kernel/prom_parse.c +++ b/arch/microblaze/kernel/prom_parse.c @@ -927,20 +927,23 @@ int of_irq_map_one(struct device_node *device, /* Get size of interrupt specifier */ tmp = of_get_property(p, "#interrupt-cells", NULL); if (tmp == NULL) { - of_node_put(p); - return -EINVAL; + res = -EINVAL; + goto out; } intsize = *tmp; pr_debug(" intsize=%d intlen=%d\n", intsize, intlen); /* Check index */ - if ((index + 1) * intsize > intlen) - return -EINVAL; + if ((index + 1) * intsize > intlen) { + res = -EINVAL; + goto out; + } /* Get new specifier and map it */ res = of_irq_map_raw(p, intspec + index * intsize, intsize, addr, out_irq); +out: of_node_put(p); return res; }