[dm-devel] [PATCH V2 06/14] kpartx: check return value of malloc in main func

2020-09-08 Thread lixiaokeng
In main func of kpartx.c, we should check return value of malloc before using it. V1->V2: change malloc to xmalloc Signed-off-by: Zhiqiang Liu Signed-off-by: Lixiaokeng --- kpartx/kpartx.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c

[dm-devel] [PATCH V2 09/14] libmultipath: check whether mp->features is NUll in assemble_map

2020-09-08 Thread lixiaokeng
In assemble_map func, if add_feature fails and mp->features is default value (NULL), STRDUP(mp->features) will cause a seg-fault. In addition, f = STRDUP(mp->features) is just used for APPEND(). We can directly pass mp->features to APPEND(). Here, we firstly check whether mp->features is null. V1

[dm-devel] [PATCH V2 11/14] mpathpersist: check whether malloc paramp->trnptid_list fails in handle_args func

2020-09-08 Thread lixiaokeng
In handle_args func, we donot check whether malloc paramp and each paramp->trnptid_list[j] fails before using them, it may cause access NULL pointer. Here, we add alloc_prout_param_descriptor to allocate and init paramp, and we add free_prout_param_descriptor to free paramp and each paramp->trnpti

[dm-devel] [PATCH V2 12/14] libmultipathpersist: use update_multipath_table/status in get_mpvec

2020-09-08 Thread lixiaokeng
The return values of dm_get_map, disassemble_map in get_mpvec were not checked. Use update_multipath_table/status to instead of them. V1->V2: delete continue and add remove_map Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmpathpersist/mpath_persist.c

[dm-devel] [PATCH V2 14/14] multipathpersist: delete unused variable in handle_args

2020-09-08 Thread lixiaokeng
In handle_args, the tmp isn't used. We delete it. V1->V2: modify patch because of "mpathpersist: check whether malloc paramp->trnptid_list fails in handle_args func" changing Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- mpathpersist/main.c | 1 - 1 file

Re: [dm-devel] [PATCH V2 00/14] multipath-tools series: some cleanups and fixes checked by codedex tool

2020-09-08 Thread Martin Wilck
On Tue, 2020-09-08 at 14:50 +0800, lixiaokeng wrote: > Patches 01, 02, 04, 05, 06, 09, 11, 12, 14 have some changes. Thanks. What about No. 08? Did you drop it? If yes, please say so. Regards, Martin -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH V2 00/14] multipath-tools series: some cleanups and fixes checked by codedex tool

2020-09-08 Thread lixiaokeng
On 2020/9/8 15:10, Martin Wilck wrote: > On Tue, 2020-09-08 at 14:50 +0800, lixiaokeng wrote: >> Patches 01, 02, 04, 05, 06, 09, 11, 12, 14 have some changes. > > Thanks. > What about No. 08? Did you drop it? If yes, please say so. > > Regards, > Martin > Hi Martin, I drop No. 08. I'm sor

Re: [dm-devel] [PATCH V2 00/14] multipath-tools series: some cleanups and fixes checked by codedex tool

2020-09-08 Thread Martin Wilck
Hello lixiaokeng, On Tue, 2020-09-08 at 14:50 +0800, lixiaokeng wrote: > Patches 01, 02, 04, 05, 06, 09, 11, 12, 14 have some changes. I have problems applying your patches. It seems to me that the whitespace has been messed up by your mail program (tab indentation has been replaced by spaces).

Re: [dm-devel] [PATCH V2 00/14] multipath-tools series: some cleanups and fixes checked by codedex tool

2020-09-08 Thread lixiaokeng
On 2020/9/8 16:15, Martin Wilck wrote: > Hello lixiaokeng, > > On Tue, 2020-09-08 at 14:50 +0800, lixiaokeng wrote: >> Patches 01, 02, 04, 05, 06, 09, 11, 12, 14 have some changes. > > I have problems applying your patches. It seems to me that the > whitespace has been messed up by your mail p

[dm-devel] [PATCH V3 00/14] multipath-tools series: some cleanups and fixes checked by codedex tool

2020-09-08 Thread lixiaokeng
Patches 01, 02, 04, 05, 06, 09, 11, 12, 14 have some changes. V3 is same as V2. Changes in V2: - patch 01: set major and minor to -1 at begining, as suggested by Martin Wilck - patch 02: chanege malloc to calloc to calloc, as suggested by Martin Wilck - patch 04: delete seting ret when jump t

[dm-devel] [PATCH V3 01/14] multipathd: initialize major and minor in cli_add_map

2020-09-08 Thread lixiaokeng
If dm_get_major_minor failed, log with major and minor should not be printed to avoid major and minor used before initialization. V1->V2: set major and minor to -1 at begining Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- multipathd/cli_handlers.c | 2 +-

[dm-devel] [PATCH V3 02/14] libmultipath: change malloc to calloc in print_foreign_topology

2020-09-08 Thread lixiaokeng
We check the return value of malloc in print_foreign_topology. V1->V2: chanege malloc to calloc Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/foreign.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultipath/forei

[dm-devel] [PATCH V3 04/14] multipathd: check MALLOC return value in mpath_pr_event_handler_fn

2020-09-08 Thread lixiaokeng
In mpath_pr_event_handler_fn, we use MALLOC instead of malloc, and check the return value of MALLOC. V1->V2: delete seting ret when jump to out Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- multipathd/main.c | 8 1 file changed, 4 insertions(+),

[dm-devel] [PATCH V3 05/14] multipathd: use MALLOC and check return value in cli_getprkey func

2020-09-08 Thread lixiaokeng
In cli_getprkey func, we use MALLOC instead of malloc, and check the return value of MALLOC. V1->V2: turn back MALLOC to malloc and reomve error message Signed-off-by: Zhiqiang Liu Signed-off-by: Lixiaokeng Signed-off-by: Linfeilong --- multipathd/cli_handlers.c | 2 ++ 1 file changed, 2 inse

Re: [dm-devel] [PATCH V3 06/14] kpartx: check return value of malloc in main func

2020-09-08 Thread lixiaokeng
In main func of kpartx.c, we should check return value of malloc before using it. V1->V2: change malloc to xmalloc Signed-off-by: Zhiqiang Liu Signed-off-by: Lixiaokeng --- kpartx/kpartx.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c

[dm-devel] [PATCH V3 09/14] libmultipath: check whether mp->features is NUll in assemble_map

2020-09-08 Thread lixiaokeng
In assemble_map func, if add_feature fails and mp->features is default value (NULL), STRDUP(mp->features) will cause a seg-fault. In addition, f = STRDUP(mp->features) is just used for APPEND(). We can directly pass mp->features to APPEND(). Here, we firstly check whether mp->features is null. V1

[dm-devel] [PATCH V3 14/14] multipathpersist: delete unused variable in handle_args

2020-09-08 Thread lixiaokeng
In handle_args, the tmp isn't used. We delete it. V1->V2: modify patch because of "mpathpersist: check whether malloc paramp->trnptid_list fails in handle_args func" changing Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- mpathpersist/main.c | 1 - 1 file

[dm-devel] [PATCH V3 12/14] libmultipathpersist: use update_multipath_table/status in get_mpvec

2020-09-08 Thread lixiaokeng
The return values of dm_get_map, disassemble_map in get_mpvec were not checked. Use update_multipath_table/status to instead of them. V1->V2: delete continue and add remove_map Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmpathpersist/mpath_persist.c

[dm-devel] [PATCH V3 11/14] mpathpersist: check whether malloc paramp->trnptid_list fails in handle_args func

2020-09-08 Thread lixiaokeng
In handle_args func, we donot check whether malloc paramp and each paramp->trnptid_list[j] fails before using them, it may cause access NULL pointer. Here, we add alloc_prout_param_descriptor to allocate and init paramp, and we add free_prout_param_descriptor to free paramp and each paramp->trnpti

Re: [dm-devel] [PATCH V3 06/14] kpartx: check return value of malloc in main func

2020-09-08 Thread Martin Wilck
On Tue, 2020-09-08 at 16:49 +0800, lixiaokeng wrote: > In main func of kpartx.c, we should check return value of > malloc before using it. > > V1->V2: change malloc to xmalloc > > Signed-off-by: Zhiqiang Liu > Signed-off-by: Lixiaokeng > --- > kpartx/kpartx.c | 5 - > 1 file changed, 4 ins

Re: [dm-devel] [PATCH V3 05/14] multipathd: use MALLOC and check return value in cli_getprkey func

2020-09-08 Thread Martin Wilck
On Tue, 2020-09-08 at 16:49 +0800, lixiaokeng wrote: > In cli_getprkey func, we use MALLOC instead of malloc, and check > the return value of MALLOC. > > V1->V2: turn back MALLOC to malloc and reomve error message Ok, but now you need to change the patch subject as well... Also, please don't inc

Re: [dm-devel] [PATCH 09/14] libmultipath: check whether mp->features is NULl in, assemble_map

2020-09-08 Thread Benjamin Marzinski
On Mon, Sep 07, 2020 at 08:21:28PM +0800, lixiaokeng wrote: > > >> @@ -86,9 +86,12 @@ assemble_map (struct multipath * mp, char * params, int > >> len) > >>get_linux_version_code() < KERNEL_VERSION(4, 3, 0)) > >>add_feature(&mp->features, retain_hwhandler); > >> > >> - f = ST

Re: [dm-devel] [PATCH 09/14] libmultipath: check whether mp->features is NULl in, assemble_map

2020-09-08 Thread Martin Wilck
On Tue, 2020-09-08 at 10:45 -0500, Benjamin Marzinski wrote: > On Mon, Sep 07, 2020 at 08:21:28PM +0800, lixiaokeng wrote: > > > > @@ -86,9 +86,12 @@ assemble_map (struct multipath * mp, char * > > > > params, int len) > > > > get_linux_version_code() < KERNEL_VERSION(4, 3, 0)) > > > >

Re: [dm-devel] [PATCH 09/14] libmultipath: check whether mp->features is NULl in, assemble_map

2020-09-08 Thread Benjamin Marzinski
On Tue, Sep 08, 2020 at 06:35:45PM +0200, Martin Wilck wrote: > On Tue, 2020-09-08 at 10:45 -0500, Benjamin Marzinski wrote: > > On Mon, Sep 07, 2020 at 08:21:28PM +0800, lixiaokeng wrote: > > > > > @@ -86,9 +86,12 @@ assemble_map (struct multipath * mp, char * > > > > > params, int len) > > > > >

Re: [dm-devel] [PATCH V3 06/14] kpartx: check return value of malloc in main func

2020-09-08 Thread lixiaokeng
On 2020/9/8 22:25, Martin Wilck wrote: > On Tue, 2020-09-08 at 16:49 +0800, lixiaokeng wrote: >> In main func of kpartx.c, we should check return value of >> malloc before using it. >> >> V1->V2: change malloc to xmalloc >> >> Signed-off-by: Zhiqiang Liu >> Signed-off-by: Lixiaokeng >> --- >>

Re: [dm-devel] [PATCH V3 05/14] multipathd: use MALLOC and check return value in cli_getprkey func

2020-09-08 Thread lixiaokeng
On 2020/9/8 22:32, Martin Wilck wrote: > On Tue, 2020-09-08 at 16:49 +0800, lixiaokeng wrote: >> In cli_getprkey func, we use MALLOC instead of malloc, and check >> the return value of MALLOC. >> >> V1->V2: turn back MALLOC to malloc and reomve error message > > Ok, but now you need to change t

Re: [dm-devel] [PATCH 09/14] libmultipath: check whether mp->features is NULl in, assemble_map

2020-09-08 Thread lixiaokeng
On 2020/9/9 0:35, Martin Wilck wrote: > On Tue, 2020-09-08 at 10:45 -0500, Benjamin Marzinski wrote: >> On Mon, Sep 07, 2020 at 08:21:28PM +0800, lixiaokeng wrote: > @@ -86,9 +86,12 @@ assemble_map (struct multipath * mp, char * > params, int len) > get_linux_version_code() < K