projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e11a47f
)
clk: pxa: add a check for the return value of kzalloc()
author
Xiaoke Wang
<xkernel.wang@foxmail.com>
Thu, 7 Apr 2022 09:33:49 +0000
(17:33 +0800)
committer
Stephen Boyd
<sboyd@kernel.org>
Mon, 3 Oct 2022 19:32:03 +0000
(12:32 -0700)
kzalloc() is a memory allocation function which can return NULL when
some internal memory errors happen. So it is better to check it to
prevent potential wrong memory access.
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link:
https://lore.kernel.org/r/tencent_2B9817738F38B02844C245946EFF3B407E09@qq.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/pxa/clk-pxa.c
patch
|
blob
|
history
diff --git
a/drivers/clk/pxa/clk-pxa.c
b/drivers/clk/pxa/clk-pxa.c
index 03de634efc5249c6bef7d54f3ca0764c12197758..374098ebbf2b6be139212c904d0ff5adb04cbd7e 100644
(file)
--- a/
drivers/clk/pxa/clk-pxa.c
+++ b/
drivers/clk/pxa/clk-pxa.c
@@
-104,6
+104,8
@@
int __init clk_pxa_cken_init(const struct desc_clk_cken *clks,
for (i = 0; i < nb_clks; i++) {
pxa_clk = kzalloc(sizeof(*pxa_clk), GFP_KERNEL);
+ if (!pxa_clk)
+ return -ENOMEM;
pxa_clk->is_in_low_power = clks[i].is_in_low_power;
pxa_clk->lp = clks[i].lp;
pxa_clk->hp = clks[i].hp;