diff options
author | Xiaoke Wang <xkernel.wang@foxmail.com> | 2022-03-25 14:49:41 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-25 10:17:54 +0300 |
commit | 9b7f3211064dcb7c59f0fc2f10b26652267d9800 (patch) | |
tree | d99f6b4d57e64659ea4256e187b8d091c6f61dc3 /arch/mips/lantiq/falcon | |
parent | 05c073b1ad2565a9c4eeb05a3414aef19985fe57 (diff) | |
download | linux-9b7f3211064dcb7c59f0fc2f10b26652267d9800.tar.xz |
MIPS: lantiq: check the return value of kzalloc()
[ Upstream commit 34123208bbcc8c884a0489f543a23fe9eebb5514 ]
kzalloc() is a memory allocation function which can return NULL when
some internal memory errors happen. So it is better to check the
return value of it to prevent potential wrong memory access or
memory leak.
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/mips/lantiq/falcon')
-rw-r--r-- | arch/mips/lantiq/falcon/sysctrl.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/mips/lantiq/falcon/sysctrl.c b/arch/mips/lantiq/falcon/sysctrl.c index 42222f849bd2..446a2536999b 100644 --- a/arch/mips/lantiq/falcon/sysctrl.c +++ b/arch/mips/lantiq/falcon/sysctrl.c @@ -167,6 +167,8 @@ static inline void clkdev_add_sys(const char *dev, unsigned int module, { struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); + if (!clk) + return; clk->cl.dev_id = dev; clk->cl.con_id = NULL; clk->cl.clk = clk; |