MIPS: Loongson: Fix potential NULL dereference in loongson3_platform_init()
authorTiezhu Yang <yangtiezhu@loongson.cn>
Fri, 10 Jan 2020 01:30:42 +0000 (09:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Feb 2020 14:42:19 +0000 (15:42 +0100)
commit2904a206ee298b1b9738f5d6226eb7f43ff822e6
tree7df4efa58b0ee2bfc2cdd30c1dbe36326fa4606c
parent7711cb4324b2ab2a20c9cfbd2fdbad248587d5c9
MIPS: Loongson: Fix potential NULL dereference in loongson3_platform_init()

[ Upstream commit 72d052e28d1d2363f9107be63ef3a3afdea6143c ]

If kzalloc fails, it should return -ENOMEM, otherwise may trigger a NULL
pointer dereference.

Fixes: 3adeb2566b9b ("MIPS: Loongson: Improve LEFI firmware interface")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/mips/loongson64/loongson-3/platform.c