Re: [PATCH 04/14] multipathd: check MALLOC return value in, mpath_pr_event_handler_fn

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2020-09-02 at 15:17 +0800, lixiaokeng wrote:
> In  mpath_pr_event_handler_fn, we use MALLOC instead of malloc, and
> check
> the return value of MALLOC.
> 
> Signed-off-by: Lixiaokeng <lixiaokeng@xxxxxxxxxx>
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@xxxxxxxxxx>
> Signed-off-by: Linfeilong <linfeilong@xxxxxxxxxx>
> ---
>  multipathd/main.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/multipathd/main.c b/multipathd/main.c
> index 67e9af11..7180d3c1 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -3391,8 +3391,12 @@ void *  mpath_pr_event_handler_fn (void *
> pathp )
>  		goto out;
>  	}
> 
> -	param= malloc(sizeof(struct prout_param_descriptor));
> -	memset(param, 0 , sizeof(struct prout_param_descriptor));
> +	param = (struct prout_param_descriptor *)MALLOC(sizeof(struct
> prout_param_descriptor));
> +	if (!param) {
> +		ret = MPATH_PR_OTHER;
> +		goto out;
> +	}

No need to set the local variable "ret" when you jump to "out". I can
see this is done elsewhere in this function, too. It has been like that
since day 1.

Regards,
Martin


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux