mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Liao Yuanhong <liaoyuanhong@vivo.com>
Cc: linux-kernel@vger.kernel.org (open list:LIBRARY CODE)
Subject: Re: [PATCH] lib/digsig: Remove unnecessary memset
Date: Mon, 11 Aug 2025 17:50:00 -0700	[thread overview]
Message-ID: <20250811175000.7f2e5fd3dc903ce5503e0ed8@linux-foundation.org> (raw)
In-Reply-To: <20250811082739.378284-1-liaoyuanhong@vivo.com>

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..

      reply	other threads:[~2025-08-12  0:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11  8:27 Liao Yuanhong
2025-08-12  0:50 ` Andrew Morton [this message]

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=20250811175000.7f2e5fd3dc903ce5503e0ed8@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=liaoyuanhong@vivo.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®