From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 3711533C51D for ; Wed, 18 Mar 2026 20:37:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773866264; cv=none; b=uxlxZwlFK95dv41k0CU/2zfjdlLlN21qplwTEjuX48sTdA0J93GijFDLo9g+4Z56LOiUd5VWyLIJVvgtXCYoectgDPGoe5ABAYB5IzFAY6ky18toK5FwZhgQ6+f6sHe/3icDZ5hZSz98O51qz7tg12MvcI4ljhxN0RWm7orpg34= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773866264; c=relaxed/simple; bh=e9pj0YRjMpSWd74MLrHduZFMfM9vNvQwKFYkK7yDf+o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VwLmJJWwFFM0hwJFqMbo+zMMglzILK6jGBfsJvOdaG8xyhYi2CYosSjtA7bgTVa2VqxDwwfNZ68C5+QaUyw10oSJQB6N6e/urBDJ7o9mp+bEMCMw9+lpCTIAh378CguFytFdGNoloXRFzdZr/ZyI3NDIxqYcnTlckS0TEjIoC1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=mu/s/rDd; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="mu/s/rDd" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=LuqOEEGRThn2fiy5zcIpvWfGIABMxL0HeedWhhHiA88=; b=mu/s/rDda8XBp5+Lz62Z7HWoEx xefTZq81378ECreh3/ZzD/zBPZkzlEWHAy3DoMBOy99lorITSKJIDiK2xUUyS2xYFm6GeEjD/JrI2 N0rafD9KwGoCUaydSHumt83n+G5bc03eZe7UqJBH2Z4E2k0m2QJWGiWpEqym9ZhfaGNHtBqocFlPy RGn36fwZl/5MtO4k9WhU7UAsQ1phruxx0dSDKoBy7OL3IBZT/2MZQ9IDgFTrgpZTRhYZmRA8cJZw7 iWLz/mUiy8bX8JYFwS3E9BKGkeQD7nvKMDw5XUZL2keB99gG/JU94mAqy5gfnYhk71zUh8buOwxl9 kt60zQyg==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1w2xe8-0000000CEB3-1IZY; Wed, 18 Mar 2026 20:37:40 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 96ADC3004F8; Wed, 18 Mar 2026 21:37:39 +0100 (CET) Date: Wed, 18 Mar 2026 21:37:39 +0100 From: Peter Zijlstra To: Thorsten Blum Cc: Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND] locking/lockdep: Replace snprintf with strscpy in seq_stats Message-ID: <20260318203739.GO3738010@noisy.programming.kicks-ass.net> References: <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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260318001426.2664-3-thorsten.blum@linux.dev> On Wed, Mar 18, 2026 at 01:14:27AM +0100, Thorsten Blum wrote: > 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(); Why though? I suppose it doesn't matter, but this hardly seems worth the electrons is was sent with :/