Re: [ndctl PATCH 6/8] lib/inject: check whether cmd is created successfully

2020-12-16 Thread Zhiqiang Liu
On 2020/12/17 11:33, Verma, Vishal L wrote: > On Fri, 2020-11-06 at 17:27 +0800, Zhiqiang Liu wrote: >> ndctl_bus_cmd_new_ars_cp() is called to create cmd, >> which may return NULL. We need to check whether it >> is NULL in callers, such as ndctl_nam

Re: [ndctl PATCH V2 0/8] fix serverl issues reported by Coverity

2020-12-16 Thread Zhiqiang Liu
On 2020/12/17 11:41, Verma, Vishal L wrote: > On Wed, 2020-11-25 at 09:00 +0800, Zhiqiang Liu wrote: >> Changes: V1->V2 >> - add one empty line in 1/8 patch as suggested by Jeff Moyer >> . >> >> >> Recently, we use Coverity to analysis the ndctl pac

[ndctl PATCH V2 1/8] namespace: check whether pfn|dax|btt is NULL in setup_namespace

2020-11-24 Thread Zhiqiang Liu
In setup_namespace(), pfn|dax|btt is obtained by calling ndctl_region_get_**_seed(), which may return NULL. So we need to check whether pfn|dax|btt is NULL before accessing them. Signed-off-by: Zhiqiang Liu Acked-by: Jeff Moyer --- ndctl/namespace.c | 6 ++ 1 file changed, 6 insertions

[ndctl PATCH V2 0/8] fix serverl issues reported by Coverity

2020-11-24 Thread Zhiqiang Liu
Changes: V1->V2 - add one empty line in 1/8 patch as suggested by Jeff Moyer . Recently, we use Coverity to analysis the ndctl package. Several issues should be resolved to make Coverity happy. Zhiqiang Liu (8): namespace: check whether pfn|dax|btt is NULL in setup_namespace lib/libnd

Re: [ndctl PATCH 0/8] fix serverl issues reported by Coverity

2020-11-22 Thread Zhiqiang Liu
Thanks for your reply. I will add one empty line in 1/8 patch in v2. Regards Zhiqiang Liu On 2020/11/21 0:45, Jeff Moyer wrote: > Zhiqiang Liu writes: > >> Recently, we use Coverity to analysis the ndctl package. >> Several issues should be resolved to make Coverity happy. &

Re: [ndctl PATCH 0/8] fix serverl issues reported by Coverity

2020-11-19 Thread Zhiqiang Liu
On 2020/11/20 10:47, Verma, Vishal L wrote: > On Fri, 2020-11-20 at 10:45 +0800, Zhiqiang Liu wrote: >> Friendly ping... >> >> I just wonder if this kind of patches will not be reviewed >> and processed. >> >> I`d be very happy to

Re: [ndctl PATCH 0/8] fix serverl issues reported by Coverity

2020-11-10 Thread Zhiqiang Liu
friendly ping... On 2020/11/6 17:23, Zhiqiang Liu wrote: > > Recently, we use Coverity to analysis the ndctl package. > Several issues should be resolved to make Coverity happy. > > lihaotian9 (8): > namespace: check whether pfn|dax|btt is NULL in setup_namespace > lib

[ndctl PATCH 8/8] Check whether seed is NULL in validate_namespace_options

2020-11-06 Thread Zhiqiang Liu
-by: Zhiqiang Liu --- ndctl/namespace.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ndctl/namespace.c b/ndctl/namespace.c index 257384d..5a92d62 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -847,8 +847,7 @@ static int validate_namespace_options

[ndctl PATCH 7/8] Check whether ndctl_btt_get_namespace returns NULL in callers

2020-11-06 Thread Zhiqiang Liu
ndctl_btt_get_namespace() may return NULL, so we need to check return value of ndctl_btt_get_namespace() before using the return value in callers. Signed-off-by: Zhiqiang Liu --- test/libndctl.c| 16 +++- test/parent-uuid.c | 2 +- util/json.c| 3 +++ 3 files changed

[ndctl PATCH 5/8] util/help: check whether strdup returns NULL in exec_man_konqueror

2020-11-06 Thread Zhiqiang Liu
In exec_man_konqueror(), new is allocated by calling strdup(), which may return NULL. We should check whether new is NULL before using it. Signed-off-by: Zhiqiang Liu --- util/help.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/help.c b/util/help.c index

[ndctl PATCH 6/8] lib/inject: check whether cmd is created successfully

2020-11-06 Thread Zhiqiang Liu
ndctl_bus_cmd_new_ars_cp() is called to create cmd, which may return NULL. We need to check whether it is NULL in callers, such as ndctl_namespace_get_clear_uint and ndctl_namespace_injection_status. Signed-off-by: Zhiqiang Liu --- ndctl/lib/inject.c | 8 1 file changed, 8 insertions

[ndctl PATCH 4/8] dimm: fix potential fd leakage in dimm_action()

2020-11-06 Thread Zhiqiang Liu
In dimm_action(), actx.f_out and actx.f_in may be set by calling fopen(). If exceptions occur, we will directly goto out tag. However, we did not close actx.f_out|actx.f_in in out tag, which will cause fd leakage. Signed-off-by: Zhiqiang Liu --- ndctl/dimm.c | 12 +++- 1 file changed

[ndctl PATCH 3/8] libdaxctl: fix memory leakage in add_dax_region()

2020-11-06 Thread Zhiqiang Liu
In add_dax_region(), region->devname is allocated by calling strdup(), which may return NULL. So, we need to check whether region->devname is NULL, and free region->devname in err_read tag. Signed-off-by: Zhiqiang Liu --- daxctl/lib/libdaxctl.c | 3 +++ 1 file changed, 3 insertions

[ndctl PATCH 2/8] lib/libndctl: fix memory leakage problem in add_bus

2020-11-06 Thread Zhiqiang Liu
In add_bus(), bus->bus_path is set by calling parent_dev_path(), which will finally adopt realpath(, NULL) to allocate new path. However, bus->bus_path will not be freed in err_read tag, then, memory leakage occurs. Signed-off-by: Zhiqiang Liu --- ndctl/lib/libndctl.c | 1 + 1 file chan

[ndctl PATCH 1/8] namespace: check whether pfn|dax|btt is NULL in setup_namespace

2020-11-06 Thread Zhiqiang Liu
In setup_namespace(), pfn|dax|btt is obtained by calling ndctl_region_get_**_seed(), which may return NULL. So we need to check whether pfn|dax|btt is NULL before accessing them. Signed-off-by: Zhiqiang Liu --- ndctl/namespace.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion

[ndctl PATCH 0/8] fix serverl issues reported by Coverity

2020-11-06 Thread Zhiqiang Liu
Recently, we use Coverity to analysis the ndctl package. Several issues should be resolved to make Coverity happy. lihaotian9 (8): namespace: check whether pfn|dax|btt is NULL in setup_namespace lib/libndctl: fix memory leakage problem in add_bus libdaxctl: fix memory leakage in