From nobody Sat Feb 7 15:09:49 2026 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 310D23112C1 for ; Mon, 26 Jan 2026 23:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769471748; cv=none; b=umO/uU1FmciJvhhquxUbaCaaC7QNa15quDG+5vpEcisGJsTI874LIwIM3EMlNBayQg+x3uiTojxvlo/aoN/xzH8AZONvdj4+zFf9A6iHdCNxoEbCFQtX864Yk6VTktpQ1RbNyi2fPwQ/JZEhh0LTHn27M8sIX1IuKRjqgi0oS8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769471748; c=relaxed/simple; bh=Pk77TSzeDZu+Am7n1vOxZiOjZwCE0Cw78/yau7UjdoM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lI7uqy0N5qz4E23C2vgKShrviKmZ996fkvCYJt1Au70Uy87f98NMKE544RA3fsiu2vHA51RWKIE21t0YuyL7G+HVTcuqSU0QyNKeUcM3Tk4NiMu16SPzyDSoDGg3Q7QShwu1jld5g20eBpUogYyNrbdCrhcptKvCD7jTBlNvKt0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=cC/4X42+; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="cC/4X42+" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1769471743; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ESNywpj5EbPR/JIRFk6eFxsl35px9XMZoJAEnhp/KZA=; b=cC/4X42+c+Ij1GZDIeq9sm2mf4xAAP1tkkdygXjzsqo5JvNsZNpu3+fqxWB1EX2tXk2oN3 O9Al7wKZDJL5rJhPu1eB43a7evXBgvS3NETOlhfLEaBwtuxchRoMgm+CC3ygSCfVkwzglD YGiLXlBBr7Kd18bOmW9pYk91fvbHtbI= From: Thorsten Blum To: Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long Cc: Thorsten Blum , linux-kernel@vger.kernel.org Subject: [PATCH] locking/lockdep: Replace snprintf with strscpy in seq_stats Date: Tue, 27 Jan 2026 00:54:56 +0100 Message-ID: <20260126235456.430591-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Replace snprintf("%s", ...) with the faster and more direct strscpy(). Signed-off-by: Thorsten Blum Reviewed-by: Waiman Long --- 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 #include #include +#include #include #include =20 @@ -488,9 +489,9 @@ static void seq_stats(struct seq_file *m, struct lock_s= tat_data *data) const char *key_name; =20 key_name =3D __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(); =20 --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4