From nobody Tue May 5 08:57:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94965C433EF for ; Wed, 25 May 2022 13:43:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244507AbiEYNnp (ORCPT ); Wed, 25 May 2022 09:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236561AbiEYNn2 (ORCPT ); Wed, 25 May 2022 09:43:28 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 970746D1AB; Wed, 25 May 2022 06:43:25 -0700 (PDT) Date: Wed, 25 May 2022 13:43:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1653486200; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n0T/htAa6Mcy4LUNx5ZyokxP7Whrk84psRqgVebcxrM=; b=JFb2cjdFGxAI+MMyQ9c27wlUHHBDbGdo0VwX/aquxcxFnRYyzwR5z3mbk3sP2tZtO1giQu jDSji4NSFdjt/RwGQjHS5w/AvSlvAUs/D4/cDQDQOdEhvg8VEVQaxF/QcnIkHqBvyJjhLg lQ4jVHt8M381Yg25j0mHij/eXnXnXuB+iYNjq5ZmqZMyeDWiQbTHZcqSfcsN8Mpegx2OpN Qp7krJxojr4LX+qRR13IxQUGC52n3GF06BfB2k6QdiNNn1p10BR9LRrTuZ1/ATuQGdy6I7 YEFxCJLT3Tr4PS3DXtZ5vTrkoVUnpy/iegmszw3TQ6m6IAFuJ34iwly5FbJXNg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1653486200; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n0T/htAa6Mcy4LUNx5ZyokxP7Whrk84psRqgVebcxrM=; b=relEWGN/Hzot3AHhyhxyvluKUk/YE5rvvMItM/CxSlFF6yqjf3Q7ia2pETKkIwInzVawwM hYoEgrNlDQialqCA== From: "tip-bot2 for XueBing Chen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] x86/setup: Use strscpy() to replace deprecated strlcpy() Cc: XueBing Chen , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <730f0fef.a33.180fa69880f.Coremail.chenxuebing@jari.cn> References: <730f0fef.a33.180fa69880f.Coremail.chenxuebing@jari.cn> MIME-Version: 1.0 Message-ID: <165348619853.4207.3379558582363552426.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/boot branch of tip: Commit-ID: 8a33d96bd178d5f49cc5c1898e4cda08e221d2db Gitweb: https://git.kernel.org/tip/8a33d96bd178d5f49cc5c1898e4cda08e= 221d2db Author: XueBing Chen AuthorDate: Wed, 25 May 2022 16:51:01 +08:00 Committer: Ingo Molnar CommitterDate: Wed, 25 May 2022 15:34:38 +02:00 x86/setup: Use strscpy() to replace deprecated strlcpy() strlcpy() is marked deprecated and should not be used, because it doesn't limit the source length. The preferred interface for when strlcpy()'s return value is not checked (truncation) is strscpy(). [ mingo: Tweaked the changelog ] Signed-off-by: XueBing Chen Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/730f0fef.a33.180fa69880f.Coremail.chenxuebi= ng@jari.cn --- arch/x86/kernel/setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 249981b..3ebb853 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -903,18 +903,18 @@ void __init setup_arch(char **cmdline_p) =20 #ifdef CONFIG_CMDLINE_BOOL #ifdef CONFIG_CMDLINE_OVERRIDE - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); + strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); #else if (builtin_cmdline[0]) { /* append boot loader cmdline to builtin */ strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE); strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE); - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); + strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); } #endif #endif =20 - strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); + strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE); *cmdline_p =3D command_line; =20 /*