lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <107b0173-f0b0-adfd-10e2-e5eb76e91b92@csgroup.eu>
Date:   Mon, 19 Dec 2022 06:42:53 +0000
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     Li zeming <zeming@...china.com>,
        "mpe@...erman.id.au" <mpe@...erman.id.au>,
        "npiggin@...il.com" <npiggin@...il.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
CC:     "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] boot: simple_alloc: check after increasing memory
 allocation



Le 19/12/2022 à 03:18, Li zeming a écrit :
> The pointer new adds judgment and should help with program robustness.

This text is not understandable.

Do you mean:

simple_malloc() will return NULL when there is now enough memory left.
Check pointer 'new' before using it to copy the old data.

> 
> Signed-off-by: Li zeming <zeming@...china.com>
> ---
>   arch/powerpc/boot/simple_alloc.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/boot/simple_alloc.c b/arch/powerpc/boot/simple_alloc.c
> index 267d6524caac..db9aaa5face3 100644
> --- a/arch/powerpc/boot/simple_alloc.c
> +++ b/arch/powerpc/boot/simple_alloc.c
> @@ -112,7 +112,9 @@ static void *simple_realloc(void *ptr, unsigned long size)
>   		return ptr;
>   
>   	new = simple_malloc(size);
> -	memcpy(new, ptr, p->size);
> +	if (new)
> +		memcpy(new, ptr, p->size);
> +
>   	simple_free(ptr);
>   	return new;
>   }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ