From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (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 AE22B1DD0D4 for ; Sun, 22 Feb 2026 20:40:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771792857; cv=none; b=mYrCU8NtjgkFfUeMEl6fEtFhbBFjIhWicd51kvU/Wu/TPliZ9lZSdZloex8qbgbxll8DoZcspDV5Yos7sYVBE5DWuodKz7gKlFWAcox/OojiixBpw+vr7T/6dAxDG8BscDQu9vvvFAWlFYaS9dc2M3iJrGiiB+m8r/c9R9n3fZU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771792857; c=relaxed/simple; bh=De2oUycVscnJjRXh5QMyjEFpDwtwDSD2N4eI02OFN/Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Mwpc0IuqlxAiz3kDKOD/hOPi7Ubae39fAgXTthtIyO6oJX32ps+CyU6gkNwf6MoB6VpZ6c1te2mIF7NkgfU7/j6TQdTlTlP9s7xIlkj/bVD5yrQrnVjf3NvaixbEJAjOyVqQlPECHPyFd7joqoN0+LysCJGgiiNZI451mai8+UY= 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=SHW9pLYp; arc=none smtp.client-ip=95.215.58.176 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="SHW9pLYp" 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=1771792853; 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=6w3g5HsyV3fGbP+lANBW79KJpBl5RvhKb31vivdWo64=; b=SHW9pLYpmVs9vxARRyfXHo/MHDK15vOUOps+snUckKfFHmbQNfAMKN5j4lUmlMSk8wPxw8 cxLxL9i/PYrErXkiyFObQ+sNxoZZQX9gSfp9ClaMddiQWlWDG+CQb5xQd5MiWEaXXbvtUT KfgY2LOZSf6xIjtbxIV1/tq3BSQMMBw= 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: Sun, 22 Feb 2026 21:40:20 +0100 Message-ID: <20260222204020.285197-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: 8bit X-Migadu-Flow: FLOW_OUT Replace snprintf("%s", ...) with the faster and more direct strscpy(). Reviewed-by: Waiman Long Signed-off-by: Thorsten Blum --- 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 @@ -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(); -- Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4