Re: [PATCH] libnvdimm/of_pmem: Add check and kfree for kstrdup

2023-06-23 Thread Ira Weiny
Jiasheng Jiang wrote: > On Wed, Jun 21, 2023 at 00:04:36 +0800, Ira Weiny wrote: > > Ira Weiny wrote: > >> Jiasheng Jiang wrote: [snip] > >> > >> Nice catch! > >> > >> However, this free needs to happen in of_pmem_region_remove() as well. > > > > Looks like the mail from my phone had html in

Re: [PATCH] libnvdimm/of_pmem: Add check and kfree for kstrdup

2023-06-22 Thread Jiasheng Jiang
On Wed, Jun 21, 2023 at 00:04:36 +0800, Ira Weiny wrote: > Ira Weiny wrote: >> Jiasheng Jiang wrote: >> > Add check for the return value of kstrdup() and return the error >> > if it fails in order to avoid NULL pointer dereference. >> > Moreover, use kfree() in the later error handling in order to

Re: [PATCH] libnvdimm/of_pmem: Add check and kfree for kstrdup

2023-06-20 Thread Ira Weiny
Ira Weiny wrote: > Jiasheng Jiang wrote: > > Add check for the return value of kstrdup() and return the error > > if it fails in order to avoid NULL pointer dereference. > > Moreover, use kfree() in the later error handling in order to avoid > > memory leak. > > > > Fixes: 49bddc73d15c

Re: [PATCH] libnvdimm/of_pmem: Add check and kfree for kstrdup

2023-06-20 Thread Ira Weiny
Jiasheng Jiang wrote: > Add check for the return value of kstrdup() and return the error > if it fails in order to avoid NULL pointer dereference. > Moreover, use kfree() in the later error handling in order to avoid > memory leak. > > Fixes: 49bddc73d15c ("libnvdimm/of_pmem: Provide a unique

[PATCH] libnvdimm/of_pmem: Add check and kfree for kstrdup

2023-06-18 Thread Jiasheng Jiang
Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference. Moreover, use kfree() in the later error handling in order to avoid memory leak. Fixes: 49bddc73d15c ("libnvdimm/of_pmem: Provide a unique name for bus provider")