]> 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>
Tue, 19 Sep 2023 10:22:38 +0000 (12:22 +0200)
commitea5bc6f5aa099e3e84d037282836234ad77cba88
treeadba140fc3de2889fc92a3cf7d19e00975fb9b7b
parent4197eeb55f4b8ca183345c2ed974cc0b3853829e
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