Re: [PATCH 05/14] multipathd: use MALLOC and check return value in, cli_getprkey func

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

 



On Wed, 2020-09-02 at 15:18 +0800, lixiaokeng wrote:
> In cli_getprkey func, we use MALLOC instead of malloc, and check
> the return value of MALLOC.
> 
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@xxxxxxxxxx>
> Signed-off-by: Lixiaokeng <lixiaokeng@xxxxxxxxxx>
> Signed-off-by: Linfeilong <linfeilong@xxxxxxxxxx>
> ---
>  multipathd/cli_handlers.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
> index 27e4574f..d345afd3 100644
> --- a/multipathd/cli_handlers.c
> +++ b/multipathd/cli_handlers.c
> @@ -1535,7 +1535,11 @@ cli_getprkey(void * v, char ** reply, int *
> len, void * data)
>  	if (!mpp)
>  		return 1;
> 
> -	*reply = malloc(26);
> +	*reply = MALLOC(26);
> +	if (!*reply) {
> +		condlog(0, "malloc *reply failed.");
> +		return 1;
> +	}

MALLOC is not necessary (*reply isn't left uninialized), nor is the
error message.

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