[PATCH v2] initramfs: Fix a missing-check bug in init/initramfs.c

2019-05-22 Thread Gen Zhang
In dir_add() and do_name(), de->name and vcollected are allocated by kstrdup(). And de->name and vcollected are dereferenced in the following codes. However, memory allocation functions such as kstrdup() may fail. Dereferencing this null pointer may cause the kernel go wrong. Thus we should check

Re: [PATCH v2] initramfs: Fix a missing-check bug in init/initramfs.c

2019-05-21 Thread Gen Zhang
On Wed, May 22, 2019 at 10:00:37AM +0800, Li Zhijian wrote: > Looks good > > but the following place should be considered as well i think > 342 vcollected = kstrdup(collected, > GFP_KERNEL); > 343 state = CopyFile; > > > Thanks > Z