From patchwork Tue Mar 17 11:43:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 12591 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 n2HBoCuI010673 for ; Tue, 17 Mar 2009 11:50:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754042AbZCQLuL (ORCPT ); Tue, 17 Mar 2009 07:50:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753955AbZCQLuL (ORCPT ); Tue, 17 Mar 2009 07:50:11 -0400 Received: from mail-ew0-f168.google.com ([209.85.219.168]:43186 "EHLO mail-ew0-f168.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754042AbZCQLuK (ORCPT ); Tue, 17 Mar 2009 07:50:10 -0400 X-Greylist: delayed 386 seconds by postgrey-1.27 at vger.kernel.org; Tue, 17 Mar 2009 07:50:09 EDT Received: by ewy12 with SMTP id 12so15025ewy.37 for ; Tue, 17 Mar 2009 04:50:07 -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:cc:subject:content-type :content-transfer-encoding; bh=4ZNoGvP2XvR1EiUZN+tDqa5IcciGIuzD2fzeMjYKEDM=; b=L1Q+3MLJ7b39R6GgJunnMlWAk7+usHOTHOQhBYDjBjqxHKaAAhvNxsCIIyhhw3eCo5 ngtEFWsCv/y5j1nk/EJ8MnL8oJZ92Cg9pnVaRt3UaGJMVq2nd8QJXdoSGPVn4dg2na1O Cp/f6tl2f+Yg0qkV4sQPhTO9j5/PwxI7fZnog= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=G4A2tc63G3bftvkC/qfKVYw22cG5QI6+D+FSuIX05ttZPoHqoGvo6bAs6WlQ+9K+P9 2SY/tFVa8XsaZvjuNv/932mn+TB0BwRSFt3NUnrNcTk1k/Oz3iKciEe2t7tlaiLMiace WC9UQ7PDuv9pFSWdmQRV64oGCTsiCcqzpCV1Y= Received: by 10.216.26.77 with SMTP id b55mr2184592wea.101.1237290220708; Tue, 17 Mar 2009 04:43:40 -0700 (PDT) Received: from ?192.168.1.115? (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id f3sm2253458nfh.5.2009.03.17.04.43.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 17 Mar 2009 04:43:40 -0700 (PDT) Message-ID: <49BF8CEC.1000901@gmail.com> Date: Tue, 17 Mar 2009 12:43:40 +0100 From: Roel Kluin User-Agent: Thunderbird 2.0.0.19 (X11/20081209) MIME-Version: 1.0 To: rmk+kernel@arm.linux.org.uk CC: linux-omap@vger.kernel.org, Linux-arm Subject: [PATCH] ARM: OMAP2: possible division by 0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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 --- -- 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;