From nobody Fri Apr 3 04:31:26 2026 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 EC8377FBAC for ; Wed, 18 Mar 2026 00:14:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773792900; cv=none; b=P/ZWdJ+wu8qCRnKNBvP5jt+TY1gGNxAuyW67u1dGwLauRH961zznjxFfzQGy67yQS5kXoP9A9p2NCT/NXYX9+ebdp2m5EEKas9vl/2BCIgPaLgbF5v3pC0XNr1LG9Hl3QeX8ibWaI76vFpL/oeFdJfQIMwxh3vrA8fpHQt+SOHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773792900; c=relaxed/simple; bh=eMNAdTvuA3/ZNDhp1jAbEiNRFiac0A0HApB8NCaON0A=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OVFivmvJwTuUZW6SSgk4kUm6vOsppW4NG3RYSCw2/q7RoPYeBmIAqUbcH+zZXyiYp81Gza4bDRGnujq/y9eE4pB1kHk+ir7+L9qONt+1GRGJ8214ESsD1c9ZnCQA1q8Go7UKaPKjsz5qB4CGlV8ezi/5fXRU7hWs45y8p6xdBv0= 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=XSeUSQAp; arc=none smtp.client-ip=91.218.175.184 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="XSeUSQAp" 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=1773792897; 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=HiXL01QNaoxXeNL8NJsyzEfCGkH8/b+GJL5KFKuvuVo=; b=XSeUSQApv8reJbtagX1Yx7P8Fni8MK8XM3pf+o1CDa6wJdSQs/m4O1kWcTcPuG/Yse8Afe qi//ubiLPiXmE1uXtrU6cnYKaZDXeK6pT/SwR47bjG1YGTBUr2YK7rjX+cLmfthES3BEy3 N3pOvDg793c/dx2QdHNIOxUzixZfvpY= From: Thorsten Blum To: Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long Cc: Thorsten Blum , linux-kernel@vger.kernel.org Subject: [PATCH RESEND] locking/lockdep: Replace snprintf with strscpy in seq_stats Date: Wed, 18 Mar 2026 01:14:27 +0100 Message-ID: <20260318001426.2664-3-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1030; i=thorsten.blum@linux.dev; h=from:subject; bh=eMNAdTvuA3/ZNDhp1jAbEiNRFiac0A0HApB8NCaON0A=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDJk73yWxP/5l4VPm2/3t4Xr10j4dK5t/B6wSom47t8qbL HupvOxeRykLgxgXg6yYIsuDWT9m+JbWVG4yidgJM4eVCWQIAxenAEyERZKR4fXOr2rW3o18inmT Oble3r3y/0jyGwfGPEbXWy+SPOJmTGH4Kzd1kguzgJL0+vcbZ3Hu3FaTuE+hOiFQ/6zlkitR17O nMwAA X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 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(). Reviewed-by: Waiman Long Signed-off-by: Thorsten Blum Acked-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();