lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250811175000.7f2e5fd3dc903ce5503e0ed8@linux-foundation.org>
Date: Mon, 11 Aug 2025 17:50:00 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Liao Yuanhong <liaoyuanhong@...o.com>
Cc: linux-kernel@...r.kernel.org (open list:LIBRARY CODE)
Subject: Re: [PATCH] lib/digsig: Remove unnecessary memset

On Mon, 11 Aug 2025 16:27:38 +0800 Liao Yuanhong <liaoyuanhong@...o.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@...o.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..

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ