From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C003836C0A2 for ; Tue, 13 Jan 2026 20:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768334814; cv=none; b=OmaK2QCmXymNG2RZ3/bJTHcmULHT9BDIKHmzNitTtmKm09XUnpk9loQcdZrYYk8ccfe9zHA4/uj/j5V2MfEE+vZ6/wSL3/WPVBvyWSyixnkWLFE83fJxJHITVMKmo9eymWMnRygqNmuZ89qijN6A1US4cVOq+AMjuEAI6XaSU1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768334814; c=relaxed/simple; bh=AjhzdJuv/fxiR72cqK6znEMRhZFwEQ9A46jq/eRCSxM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KP9ptAzooyIzVNoiwExaw5qbgJqXdESzOtigcq3k9MiBaIGGNdXn5aHl2Dory8BRapXfVyNGOYrSGWPy6P7pn2ykCL4e6WxjtSb4K70xD9IdKNiM1hmbwJ49MoEz7TJl9z94EW4jHcKZEtV7Prpk5/k8jhXb0P0pZ8l3gDTfhiE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nApA6fAQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nApA6fAQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C01FCC116C6; Tue, 13 Jan 2026 20:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768334814; bh=AjhzdJuv/fxiR72cqK6znEMRhZFwEQ9A46jq/eRCSxM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nApA6fAQFdUfQSlakBYC9YZxjG+/zPj/KsbNac8kgrDgTmvhhYqDqhNUFBc4hKb28 wO2ZJyjFoAsyrkDGRyJeZfv3zHiwvOHjlhUYzeZsnHQHbiogfi140HWjdfSl/eqR94 J3pVbzFbX5hs7R4PkDN8YaZFiHiO314viqyT3WDW5WLw1RCX+AFZPoR3d1FXmzkV72 5KcWxls4QtFGefXEzzUNPHQtu5cux5ksSxMP9jdp2B3CalWUzmWtecE+c+C1ikO6Ge 3RhFjDn2HymLoWhPjYEOgHMCeHQL59xpvDqd6h0z+6h/z/TZ1v0EmihRGWDavdlbCw 6y+4VLUooY8HQ== Date: Tue, 13 Jan 2026 17:06:51 -0300 From: Arnaldo Carvalho de Melo To: ny Cc: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf tools: Replace strlcpy with strscpy Message-ID: References: <20251209125915.305793-1-nygameemail@163.com> 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: <20251209125915.305793-1-nygameemail@163.com> On Tue, Dec 09, 2025 at 12:59:15PM +0000, ny wrote: > Replace the deprecated strlcpy function with the preferred strscpy > function in tools/perf/util/machine.c. > > strlcpy is deprecated and should be replaced with strscpy according > to kernel best practices. The strscpy function is safer and is the > recommended replacement. Take a look at this: acme@number:~/git/perf-tools-next$ git grep strscpy tools/ tools/include/linux/string.h:#define strscpy strcpy tools/testing/selftests/net/ovpn/ovpn-cli.c:#define strscpy strncpy tools/testing/selftests/net/ovpn/ovpn-cli.c: strscpy(ovpn->ifname, argv[2], IFNAMSIZ - 1); tools/testing/selftests/user_events/abi_test.c: /* strscpy is not available, use snprintf */ acme@number:~/git/perf-tools-next$ :-) srcscpy() thus seems to be only available in the kernel sources, not for tools/, that would be another project. - Arnaldo > Signed-off-by: ny > --- > tools/perf/util/machine.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c > index 841b711d9..8786764e2 100644 > --- a/tools/perf/util/machine.c > +++ b/tools/perf/util/machine.c > @@ -1052,7 +1052,7 @@ int machine__create_extra_kernel_map(struct machine *machine, > > kmap = map__kmap(map); > > - strlcpy(kmap->name, xm->name, KMAP_NAME_LEN); > + strscpy(kmap->name, xm->name, KMAP_NAME_LEN); > > err = maps__insert(machine__kernel_maps(machine), map); > > -- > 2.43.0