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: <9f79f8edfa8f7c5099b842f020782ac2@linux.ibm.com>
Date:   Mon, 27 Jun 2022 11:54:46 +0200
From:   Harald Freudenberger <freude@...ux.ibm.com>
To:     Siddh Raman Pant <code@...dh.me>
Cc:     Herbert Xu <herbert@...dor.apana.org.au>,
        Vladis Dronov <vdronov@...hat.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH 1/1] tools/testing/crypto: Use vzalloc instead of
 vmalloc+memset

On 2022-06-27 09:51, Siddh Raman Pant wrote:
> This fixes the corresponding coccinelle warning.
> 
> Signed-off-by: Siddh Raman Pant <code@...dh.me>
> ---
>  tools/testing/crypto/chacha20-s390/test-cipher.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/testing/crypto/chacha20-s390/test-cipher.c
> b/tools/testing/crypto/chacha20-s390/test-cipher.c
> index 34e8b855266f..8141d45df51a 100644
> --- a/tools/testing/crypto/chacha20-s390/test-cipher.c
> +++ b/tools/testing/crypto/chacha20-s390/test-cipher.c
> @@ -252,29 +252,26 @@ static int __init chacha_s390_test_init(void)
>  	memset(plain, 'a', data_size);
>  	get_random_bytes(plain, (data_size > 256 ? 256 : data_size));
> 
> -	cipher_generic = vmalloc(data_size);
> +	cipher_generic = vzalloc(data_size);
>  	if (!cipher_generic) {
>  		pr_info("could not allocate cipher_generic buffer\n");
>  		ret = -2;
>  		goto out;
>  	}
> -	memset(cipher_generic, 0, data_size);
> 
> -	cipher_s390 = vmalloc(data_size);
> +	cipher_s390 = vzalloc(data_size);
>  	if (!cipher_s390) {
>  		pr_info("could not allocate cipher_s390 buffer\n");
>  		ret = -2;
>  		goto out;
>  	}
> -	memset(cipher_s390, 0, data_size);
> 
> -	revert = vmalloc(data_size);
> +	revert = vzalloc(data_size);
>  	if (!revert) {
>  		pr_info("could not allocate revert buffer\n");
>  		ret = -2;
>  		goto out;
>  	}
> -	memset(revert, 0, data_size);
> 
>  	if (debug)
>  		print_hex_dump(KERN_INFO, "src: ", DUMP_PREFIX_OFFSET,
Thanks Siddh
I'll forward this patch into the s390 subsystem and on the next merge
window for the 5.20 kernel then it will appear in the upstream kernel.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ