From: Siddh Raman Pant <code@siddh.me>
To: Herbert Xu <herbert@gondor.apana.org.au>,
Harald Freudenberger <freude@linux.ibm.com>,
Vladis Dronov <vdronov@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: [PATCH 1/1] tools/testing/crypto: Use vzalloc instead of vmalloc+memset
Date: Mon, 27 Jun 2022 13:21:48 +0530 [thread overview]
Message-ID: <20220627075148.140705-1-code@siddh.me> (raw)
This fixes the corresponding coccinelle warning.
Signed-off-by: Siddh Raman Pant <code@siddh.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,
--
2.35.1
next reply other threads:[~2022-06-27 8:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 7:51 Siddh Raman Pant [this message]
2022-06-27 9:54 ` [PATCH 1/1] tools/testing/crypto: Use vzalloc instead of vmalloc+memset Harald Freudenberger
2022-06-27 10:56 ` Vlad Dronov
2022-06-28 6:41 ` Siddh Raman Pant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220627075148.140705-1-code@siddh.me \
--to=code@siddh.me \
--cc=freude@linux.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=vdronov@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox