From patchwork Thu Apr 23 12:52:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 26364 X-Patchwork-Delegate: davem@davemloft.net 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 7C0BBB7043 for ; Thu, 23 Apr 2009 22:52:54 +1000 (EST) Received: by ozlabs.org (Postfix) id 6F141DE100; Thu, 23 Apr 2009 22:52:54 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id F407CDDFAE for ; Thu, 23 Apr 2009 22:52:53 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757003AbZDWMws (ORCPT ); Thu, 23 Apr 2009 08:52:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755427AbZDWMwr (ORCPT ); Thu, 23 Apr 2009 08:52:47 -0400 Received: from mail-ew0-f176.google.com ([209.85.219.176]:34256 "EHLO mail-ew0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755315AbZDWMwr (ORCPT ); Thu, 23 Apr 2009 08:52:47 -0400 Received: by ewy24 with SMTP id 24so484656ewy.37 for ; Thu, 23 Apr 2009 05:52:44 -0700 (PDT) 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=9o7PjB9quAfl6ADmPs/N9TrdoVrcV8hQ288Z1vsbZ7c=; b=k18tQAeGrRWt2pkgJmvUABQARqJFfDQ1kOUwU2135Q69bMxaTHPlfxv76nz0X3J/4j MuvSAmtWrAm0gAxhTVESnhnjqGqS6MYlwpQnCcKpoQip4/Oz1KJfyboRjGns9hQcPyja 7nJqIeXdWxTJtprpapqBHTTtB4Y+NyE/xPei8= 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=AVEJ6Nx5DgmgfX2G1AuYCJdx3PFIXop8Uf+CA4U/RNG7HM/rF6bIAJnicp8a+BWyhZ +fIAq6w/d7ov+6PaD4MzgO5vxJwG9bUVfaq+zkuu/erDp+m1FVIk+ke2Qimph3UfQvlx koQEPyHZzyxdOZGJ/4OeVI1QD6m0vkCNa6L4k= Received: by 10.210.59.3 with SMTP id h3mr7534471eba.86.1240491164374; Thu, 23 Apr 2009 05:52:44 -0700 (PDT) Received: from ?192.168.1.115? (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 10sm23878eyz.31.2009.04.23.05.52.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 23 Apr 2009 05:52:43 -0700 (PDT) Message-ID: <49F0649C.8030908@gmail.com> Date: Thu, 23 Apr 2009 14:52:44 +0200 From: Roel Kluin User-Agent: Thunderbird 2.0.0.21 (X11/20090302) MIME-Version: 1.0 To: "David S. Miller" , netdev@vger.kernel.org Subject: [PATCH] gianfar: irq_of_parse_and_map() error unnoticed Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Not sure which irq_of_parse_and_map() is used, but I found definitions here: vi arch/microblaze/kernel/irq.c +23 vi arch/powerpc/kernel/irq.c +727 vi arch/sparc/kernel/of_device_32.c +33 vi arch/sparc/kernel/of_device_64.c +59 They either return 0 or NO_IRQ - either defined 0, -1, 255 or INT_MAX. ------------------------------>8-------------8<--------------------------------- priv->interruptTransmit, -Receive and -Error are unsigned, so the error path wasn't taken when irq_of_parse_and_map() returned an incorrect irq. Signed-off-by: Roel Kluin --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index b2c4967..e30d158 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -203,9 +203,12 @@ static int gfar_of_init(struct net_device *dev) priv->interruptError = irq_of_parse_and_map(np, 2); - if (priv->interruptTransmit < 0 || - priv->interruptReceive < 0 || - priv->interruptError < 0) { + if (priv->interruptTransmit == 0 || + priv->interruptTransmit > 254 || + priv->interruptReceive == 0 || + priv->interruptReceive > 254 || + priv->interruptError == 0 || + priv->interruptReceive > 254) { err = -EINVAL; goto err_out; }