* [PATCH] lib/digsig: Remove unnecessary memset
@ 2025-08-11 8:27 Liao Yuanhong
2025-08-12 0:50 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Liao Yuanhong @ 2025-08-11 8:27 UTC (permalink / raw)
To: Andrew Morton, open list:LIBRARY CODE; +Cc: Liao Yuanhong
kzalloc() has already been initialized to full 0 space, there is no need to
use memset() to initialize again.
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
lib/digsig.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/digsig.c b/lib/digsig.c
index 04b5e55ed95f..2b36f9cc91e9 100644
--- a/lib/digsig.c
+++ b/lib/digsig.c
@@ -159,7 +159,6 @@ static int digsig_verify_rsa(struct key *key,
len = mlen;
head = len - l;
- memset(out1, 0, head);
memcpy(out1 + head, p, l);
kfree(p);
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] lib/digsig: Remove unnecessary memset
2025-08-11 8:27 [PATCH] lib/digsig: Remove unnecessary memset Liao Yuanhong
@ 2025-08-12 0:50 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2025-08-12 0:50 UTC (permalink / raw)
To: Liao Yuanhong; +Cc: open list:LIBRARY CODE
On Mon, 11 Aug 2025 16:27:38 +0800 Liao Yuanhong <liaoyuanhong@vivo.com> wrote:
> kzalloc() has already been initialized to full 0 space, there is no need to
> use memset() to initialize again.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
> lib/digsig.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/lib/digsig.c b/lib/digsig.c
> index 04b5e55ed95f..2b36f9cc91e9 100644
> --- a/lib/digsig.c
> +++ b/lib/digsig.c
> @@ -159,7 +159,6 @@ static int digsig_verify_rsa(struct key *key,
>
> len = mlen;
> head = len - l;
> - memset(out1, 0, head);
> memcpy(out1 + head, p, l);
>
> kfree(p);
It would be a little faster to leave this part as-is and replace the
kzalloc() with kmalloc(), no? Seems that `mlen' will be small, so any
difference will be unmeasurable..
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-12 0:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-11 8:27 [PATCH] lib/digsig: Remove unnecessary memset Liao Yuanhong
2025-08-12 0:50 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®