From patchwork Tue Apr 14 21:57:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 18241 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 n3ELvEWT011339 for ; Tue, 14 Apr 2009 21:57:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752307AbZDNV5N (ORCPT ); Tue, 14 Apr 2009 17:57:13 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753343AbZDNV5M (ORCPT ); Tue, 14 Apr 2009 17:57:12 -0400 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:51558 "EHLO mho-02-ewr.mailhop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752307AbZDNV5M (ORCPT ); Tue, 14 Apr 2009 17:57:12 -0400 Received: from c-67-160-239-110.hsd1.ca.comcast.net ([67.160.239.110] helo=[127.0.0.1]) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.68) (envelope-from ) id 1Ltqcx-0002ha-5Y; Tue, 14 Apr 2009 21:57:11 +0000 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 67.160.239.110 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/fYXMZdX24nHchQKv+oeL8 Subject: [PATCH 07/11] ARM: OMAP2: possible division by 0 To: linux-arm-kernel@lists.arm.linux.org.uk From: Tony Lindgren Cc: linux-omap@vger.kernel.org, Roel Kluin Date: Tue, 14 Apr 2009 14:57:03 -0700 Message-ID: <20090414215703.9878.96593.stgit@localhost> In-Reply-To: <20090414214638.9878.17987.stgit@localhost> References: <20090414214638.9878.17987.stgit@localhost> User-Agent: StGit/0.14.3.343.g0584 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Roel Kluin In linus' git tree the functions can be found at: vi arch/arm/mach-omap2/usb-tusb6010.c +200 - tusb6010_platform_retime() vi arch/arm/mach-omap2/gpmc.c +94 - gpmc_get_fclk_period() vi arch/arm/mach-omap2/usb-tusb6010.c +53 - tusb_set_async_mode() vi arch/arm/mach-omap2/usb-tusb6010.c +111 - tusb_set_sync_mode() is -ENODEV appropriate when sysclk_ps == 0? This was found by code analysis, please review. ------------------------------>8-------------8<--------------------------------- gpmc_get_fclk_period() may return 0 when gpmc_l3_clk is not enabled. This is not checked in tusb6010_platform_retime() nor in tusb_set_async_mode() it seems. In tusb_set_sync_mode() this may result in a division by zero. Signed-off-by: Roel Kluin Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/usb-tusb6010.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-omap" 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/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c index 15e5090..8df55f4 100644 --- a/arch/arm/mach-omap2/usb-tusb6010.c +++ b/arch/arm/mach-omap2/usb-tusb6010.c @@ -187,7 +187,7 @@ int tusb6010_platform_retime(unsigned is_refclk) unsigned sysclk_ps; int status; - if (!refclk_psec) + if (!refclk_psec || sysclk_ps == 0) return -ENODEV; sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60;