tools/testing/crypto: Use vzalloc instead of vmalloc+memset
authorSiddh Raman Pant <code@siddh.me>
Mon, 27 Jun 2022 07:51:48 +0000 (13:21 +0530)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Tue, 5 Jul 2022 12:46:36 +0000 (14:46 +0200)
This fixes the corresponding coccinelle warning.

Signed-off-by: Siddh Raman Pant <code@siddh.me>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Link: https://lore.kernel.org/r/20220627075148.140705-1-code@siddh.me
[agordeev@linux.ibm.com added Link]
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
tools/testing/crypto/chacha20-s390/test-cipher.c

index 34e8b85..8141d45 100644 (file)
@@ -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,