From patchwork Sat Jan 25 01:32:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Emilio_L=C3=B3pez?= X-Patchwork-Id: 3536661 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 81CBA9F377 for ; Sat, 25 Jan 2014 01:35:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9D3022015D for ; Sat, 25 Jan 2014 01:35:32 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36F4720154 for ; Sat, 25 Jan 2014 01:35:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6s9M-0003gr-Sq; Sat, 25 Jan 2014 01:35:09 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6s9K-00041f-78; Sat, 25 Jan 2014 01:35:06 +0000 Received: from yotta.elopez.com.ar ([2a00:1768:1004:d00d:c0de:4:f00d:cafe]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6s9G-00041H-Fs for linux-arm-kernel@lists.infradead.org; Sat, 25 Jan 2014 01:35:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=elopez.com.ar; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=KBAxaMfUNtxd80U8ctOSCX0ndvzHUzD/sgz+oX6RLsI=; b=YVzRQrTmbniBQ+VRruWH3j+8Lc5pGY9WLdsgMykJm7q5/imnhxWoMXMXr0j/55txkpYqXOrDWbHI9HiRD6F7+OGO9i57d3/B8lIwYVGkjqZidBCGXI5N/v6URzPg2biRJt1GwGmR7XW4j991ggSrBbUzR0jUMxtAJbzJ5OloFx+0TwvEZeiLnndzM5R7cTOYr/TJ3gqc5fOKeyIg90C7DeHYJpYMWm8MXRhBmzsPgz39k567uf6+3gfRy08L9BOtoqhWq887ElTzmho+DaERHfhx/XfUbNDfHl8MGwYJs6KTK94kda28P94G8/GLalVLUuMVnOe1txInSDz4AZ/itQ==; Received: from 201-212-118-243.prima.net.ar ([201.212.118.243] helo=desktop.lan) by yotta.elopez.com.ar with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA256:128) (Exim 4.82) id 1W6s8E-0003tr-TA; Fri, 24 Jan 2014 22:33:59 -0300 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= To: Mike Turquette Subject: [PATCH] clk: sunxi: fix overflow when setting up divided factors Date: Fri, 24 Jan 2014 22:32:41 -0300 Message-Id: <1390613561-28636-1-git-send-email-emilio@elopez.com.ar> X-Mailer: git-send-email 1.8.5.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140124_203502_828372_166B6EF8 X-CRM114-Status: GOOD ( 10.27 ) X-Spam-Score: -2.6 (--) Cc: =?UTF-8?q?Emilio=20L=C3=B3pez?= , dan.carpenter@oracle.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, we are allocating space for two pointers, when we actually may need to store three of them (two divisors plus the original clock). Fix this, and change sizeof(type) to sizeof(*var) to keep checkpatch.pl happy. Reported-by: Dan Carpenter Signed-off-by: Emilio López --- Hi Mike, Is there any chance you can include this oneliner on your second part of the pull request to Linus? Cheers, Emilio drivers/clk/sunxi/clk-sunxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c index 659e4ea..abb6c5a 100644 --- a/drivers/clk/sunxi/clk-sunxi.c +++ b/drivers/clk/sunxi/clk-sunxi.c @@ -875,7 +875,7 @@ static void __init sunxi_divs_clk_setup(struct device_node *node, if (!clk_data) return; - clks = kzalloc(SUNXI_DIVS_MAX_QTY * sizeof(struct clk *), GFP_KERNEL); + clks = kzalloc((SUNXI_DIVS_MAX_QTY+1) * sizeof(*clks), GFP_KERNEL); if (!clks) goto free_clkdata;