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: <8f74c94a-3d53-475a-85ff-571c00029a1d@redhat.com>
Date: Mon, 26 Jan 2026 22:42:49 -0500
From: Waiman Long <llong@...hat.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>,
 Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
 Will Deacon <will@...nel.org>, Boqun Feng <boqun.feng@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] locking/lockdep: Replace snprintf with strscpy in
 seq_stats

On 1/26/26 6:54 PM, Thorsten Blum wrote:
> Replace snprintf("%s", ...) with the faster and more direct strscpy().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
> ---
>   kernel/locking/lockdep_proc.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
> index 1916db9aa46b..e458fa258d05 100644
> --- a/kernel/locking/lockdep_proc.c
> +++ b/kernel/locking/lockdep_proc.c
> @@ -19,6 +19,7 @@
>   #include <linux/debug_locks.h>
>   #include <linux/vmalloc.h>
>   #include <linux/sort.h>
> +#include <linux/string.h>
>   #include <linux/uaccess.h>
>   #include <asm/div64.h>
>   
> @@ -488,9 +489,9 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data)
>   		const char *key_name;
>   
>   		key_name = __get_key_name(ckey, str);
> -		snprintf(name, namelen, "%s", key_name);
> +		strscpy(name, key_name, namelen);
>   	} else {
> -		snprintf(name, namelen, "%s", cname);
> +		strscpy(name, cname, namelen);
>   	}
>   	rcu_read_unlock_sched();
>   
Reviewed-by: Waiman Long <longman@...hat.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ