* [PATCH 1/1] tools/testing/crypto: Use vzalloc instead of vmalloc+memset
@ 2022-06-27 7:51 Siddh Raman Pant
2022-06-27 9:54 ` Harald Freudenberger
0 siblings, 1 reply; 4+ messages in thread
From: Siddh Raman Pant @ 2022-06-27 7:51 UTC (permalink / raw)
To: Herbert Xu, Harald Freudenberger, Vladis Dronov; +Cc: LKML, Shuah Khan
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] tools/testing/crypto: Use vzalloc instead of vmalloc+memset
2022-06-27 7:51 [PATCH 1/1] tools/testing/crypto: Use vzalloc instead of vmalloc+memset Siddh Raman Pant
@ 2022-06-27 9:54 ` Harald Freudenberger
2022-06-27 10:56 ` Vlad Dronov
0 siblings, 1 reply; 4+ messages in thread
From: Harald Freudenberger @ 2022-06-27 9:54 UTC (permalink / raw)
To: Siddh Raman Pant; +Cc: Herbert Xu, Vladis Dronov, LKML, Shuah Khan
On 2022-06-27 09:51, Siddh Raman Pant wrote:
> 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,
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] tools/testing/crypto: Use vzalloc instead of vmalloc+memset
2022-06-27 9:54 ` Harald Freudenberger
@ 2022-06-27 10:56 ` Vlad Dronov
2022-06-28 6:41 ` Siddh Raman Pant
0 siblings, 1 reply; 4+ messages in thread
From: Vlad Dronov @ 2022-06-27 10:56 UTC (permalink / raw)
To: freude, Siddh Raman Pant; +Cc: Herbert Xu, LKML, Shuah Khan
Thanks, Siddh,
This change makes perfect sense.
Thanks, Harald, for helping with this!
Best regards,
Vladis Dronov | Red Hat, Inc. | The Core Kernel | Senior Software Engineer
On Mon, Jun 27, 2022 at 11:54 AM Harald Freudenberger
<freude@linux.ibm.com> wrote:
>
> On 2022-06-27 09:51, Siddh Raman Pant wrote:
> > 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,
>
> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] tools/testing/crypto: Use vzalloc instead of vmalloc+memset
2022-06-27 10:56 ` Vlad Dronov
@ 2022-06-28 6:41 ` Siddh Raman Pant
0 siblings, 0 replies; 4+ messages in thread
From: Siddh Raman Pant @ 2022-06-28 6:41 UTC (permalink / raw)
To: Vlad Dronov, Harald Freudenberger
Cc: Herbert Xu, LKML, Shuah Khan, Kernel Mentees List
On Mon, 27 Jun 2022 16:26:12 +0530 Vlad Dronov <vdronov@redhat.com> wrote
> Thanks, Siddh,
>
> This change makes perfect sense.
On Mon, 27 Jun 2022 15:24:46 +0530 Harald Freudenberger <freude@linux.ibm.com> wrote
> 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.
Thanks Harald, and Vlad.
Apologies for not CC'ng it to the s390 mailing list. The MAINTAINERS file does not
have entry for this file. I will send the patch for it.
Thanks,
Siddh
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-28 6:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-27 7:51 [PATCH 1/1] tools/testing/crypto: Use vzalloc instead of vmalloc+memset Siddh Raman Pant
2022-06-27 9:54 ` Harald Freudenberger
2022-06-27 10:56 ` Vlad Dronov
2022-06-28 6:41 ` Siddh Raman Pant
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox