powerpc/mm: Fix null-pointer dereference in pgtable_cache_add
authorKunwu Chan <chentao@kylinos.cn>
Mon, 4 Dec 2023 02:32:23 +0000 (10:32 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 13 Dec 2023 11:13:41 +0000 (22:13 +1100)
commitf46c8a75263f97bda13c739ba1c90aced0d3b071
tree141cd712c2036c8907a149881f8c81c36e4bbc73
parentb20f98e8b3deb50247603f0242ee2d1e38726635
powerpc/mm: Fix null-pointer dereference in pgtable_cache_add

kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.

Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231204023223.2447523-1-chentao@kylinos.cn
arch/powerpc/mm/init-common.c