summaryrefslogtreecommitdiff
path: root/drivers/clk
diff options
context:
space:
mode:
authorFedor Pchelkin <pchelkin@ispras.ru>2025-04-26 15:54:28 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-19 16:33:38 +0200
commit8d54bd8d8768af087b17eea368c1aa6210e826b2 (patch)
treeae98d406c06514584c76dfbc41a5be82d985274b /drivers/clk
parent28defa35ed158bcca43e0d3d0122e747f57be867 (diff)
downloadlinux-8d54bd8d8768af087b17eea368c1aa6210e826b2.tar.gz
linux-8d54bd8d8768af087b17eea368c1aa6210e826b2.tar.bz2
linux-8d54bd8d8768af087b17eea368c1aa6210e826b2.zip
clk: tegra: do not overallocate memory for bpmp clocks
[ Upstream commit 49ef6491106209c595476fc122c3922dfd03253f ] struct tegra_bpmp::clocks is a pointer to a dynamically allocated array of pointers to 'struct tegra_bpmp_clk'. But the size of the allocated area is calculated like it is an array containing actual 'struct tegra_bpmp_clk' objects - it's not true, there are just pointers. Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool. Fixes: 2db12b15c6f3 ("clk: tegra: Register clocks from root to leaf") Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/tegra/clk-bpmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
index 7bfba0afd778..4ec408c3a26a 100644
--- a/drivers/clk/tegra/clk-bpmp.c
+++ b/drivers/clk/tegra/clk-bpmp.c
@@ -635,7 +635,7 @@ static int tegra_bpmp_register_clocks(struct tegra_bpmp *bpmp,
bpmp->num_clocks = count;
- bpmp->clocks = devm_kcalloc(bpmp->dev, count, sizeof(struct tegra_bpmp_clk), GFP_KERNEL);
+ bpmp->clocks = devm_kcalloc(bpmp->dev, count, sizeof(*bpmp->clocks), GFP_KERNEL);
if (!bpmp->clocks)
return -ENOMEM;