Re: [PATCH v2] initramfs: Fix a missing-chek bug in dir_add()teven.pr...@arm.com、

2019-05-23 Thread Gen Zhang
On Thu, May 23, 2019 at 08:35:23PM -0700, Andrew Morton wrote: > On Fri, 24 May 2019 11:30:45 +0800 Gen Zhang wrote: > > > 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 a

Re: [PATCH v2] initramfs: Fix a missing-chek bug in dir_add()

2019-05-23 Thread Andrew Morton
On Fri, 24 May 2019 11:30:45 +0800 Gen Zhang wrote: > 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 nul

[PATCH v2] initramfs: Fix a missing-chek bug in dir_add()

2019-05-23 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