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)
committerRob Herring <robh@kernel.org>
Thu, 27 Jul 2023 17:04:07 +0000 (11:04 -0600)
commitd6ce4f0ea19c32f10867ed93d8386924326ab474
tree9494b3b51503c9182348c21f28c8f2b7a3509547
parent3e77308102571db549f971e661deb4998294c832
of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name()

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>
drivers/of/unittest.c