aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorEmilio López <emilio@elopez.com.ar>2014-01-24 20:32:41 -0500
committerMike Turquette <mturquette@linaro.org>2014-01-27 15:28:23 -0500
commitd1933689aa9ce2e07fe9e7e2ff77358f8bb11864 (patch)
treeec8199bbfd812cf7b144d6df6c8408a34c462c48 /drivers/clk
parent0b7f04b868ec1230cf2dd698697dbc32a509ea4d (diff)
clk: sunxi: fix overflow when setting up divided factors
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 <dan.carpenter@oracle.com> Signed-off-by: Emilio López <emilio@elopez.com.ar> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/sunxi/clk-sunxi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 659e4ea31893..abb6c5ac8a10 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,
875 if (!clk_data) 875 if (!clk_data)
876 return; 876 return;
877 877
878 clks = kzalloc(SUNXI_DIVS_MAX_QTY * sizeof(struct clk *), GFP_KERNEL); 878 clks = kzalloc((SUNXI_DIVS_MAX_QTY+1) * sizeof(*clks), GFP_KERNEL);
879 if (!clks) 879 if (!clks)
880 goto free_clkdata; 880 goto free_clkdata;
881 881