]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name()
authorRuan Jinjie <ruanjinjie@huawei.com>
Thu, 27 Jul 2023 08:02:46 +0000 (16:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Sep 2023 08:46:56 +0000 (10:46 +0200)
commitc364fa869b33ca42a263bf91c22fce7e6c61d479
tree2690e44bdc974c49d71797f58f1ea0b0bd5a213a
parent43f1779cea7b6c155aa22a78e68fcf405a07af0c
of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name()

[ Upstream commit d6ce4f0ea19c32f10867ed93d8386924326ab474 ]

when kmalloc() fail to allocate memory in kasprintf(), name
or full_name will be NULL, strcmp() will cause
null pointer dereference.

Fixes: 0d638a07d3a1 ("of: Convert to using %pOF instead of full_name")
Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20230727080246.519539-1-ruanjinjie@huawei.com
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/of/unittest.c