Re: [PATCH] powerpc/mm: Fix null-pointer dereference in pgtable_cache_add

2023-11-30 Thread Kunwu Chan
Thanks for your reply. Ok, I know what you mean, when name is NULL. The process should be aborted and the specific reason for the error should be printed, not just return. I will update v2 patch with "panic". Thanks again, Kunwu On 2023/11/28 19:32, Michael Ellerman wrote: Kunwu Chan writ

Re: [PATCH] powerpc/mm: Fix null-pointer dereference in pgtable_cache_add

2023-11-28 Thread Michael Ellerman
Kunwu Chan writes: > Hi Christophe, > > Thanks for your reply. > It's my bad. According your reply, i read the code in > sysfs_do_create_link_sd.There is a null pointer check indeed. > > My intention was to check null pointer after memory allocation. > Whether we can add a comment here for someon

Re: [PATCH] powerpc/mm: Fix null-pointer dereference in pgtable_cache_add

2023-11-26 Thread Kunwu Chan
Hi Christophe, Thanks for your reply. It's my bad. According your reply, i read the code in sysfs_do_create_link_sd.There is a null pointer check indeed. My intention was to check null pointer after memory allocation. Whether we can add a comment here for someone like me, the null pointer che

Re: [PATCH] powerpc/mm: Fix null-pointer dereference in pgtable_cache_add

2023-11-24 Thread Christophe Leroy
Le 22/11/2023 à 10:00, Kunwu Chan a écrit : > [Vous ne recevez pas souvent de courriers de chen...@kylinos.cn. Découvrez > pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] > > kasprintf() returns a pointer to dynamically allocated memory > which can be NULL upon fai

[PATCH] powerpc/mm: Fix null-pointer dereference in pgtable_cache_add

2023-11-22 Thread Kunwu Chan
kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity. Signed-off-by: Kunwu Chan --- arch/powerpc/mm/init-common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/mm/i