From patchwork Sun May 22 07:46:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: XueBing Chen X-Patchwork-Id: 12858108 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 93681C433EF for ; Sun, 22 May 2022 07:52:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236599AbiEVHwA (ORCPT ); Sun, 22 May 2022 03:52:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236250AbiEVHwA (ORCPT ); Sun, 22 May 2022 03:52:00 -0400 Received: from jari.cn (unknown [218.92.28.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 48AEE167F8; Sun, 22 May 2022 00:51:54 -0700 (PDT) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Sun, 22 May 2022 15:46:18 +0800 (GMT+08:00) X-Originating-IP: [182.148.12.156] Date: Sun, 22 May 2022 15:46:18 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: =?utf-8?b?6ZmI5a2m5YW1?= To: tsbogend@alpha.franken.de Cc: catalin.marinas@arm.com, rdunlap@infradead.org, rppt@kernel.org, rafael.j.wysocki@intel.com, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mips: setup: use strscpy to replace strlcpy X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT6.0.1 build 20210329(c53f3fee) Copyright (c) 2002-2022 www.mailtech.cn mispb-4e503810-ca60-4ec8-a188-7102c18937cf-zhkzyfz.cn MIME-Version: 1.0 Message-ID: <533ed227.9dd.180eabb3189.Coremail.chenxuebing@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwA3QW9K6oliBek2AA--.600W X-CM-SenderInfo: hfkh05pxhex0nj6mt2flof0/1tbiAQAKCmFEYxsjpwAJsR X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org The strlcpy should not be used because it doesn't limit the source length. Preferred is strscpy. Signed-off-by: XueBing Chen --- arch/mips/kernel/setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index ef73ba1e0ec1..ad3aea81d0e2 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -554,7 +554,7 @@ static void __init bootcmdline_init(void) * unmodified. */ if (IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) { - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); + strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); return; } @@ -566,7 +566,7 @@ static void __init bootcmdline_init(void) * boot_command_line to undo anything early_init_dt_scan_chosen() did. */ if (IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND)) - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); + strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); else boot_command_line[0] = 0; @@ -628,7 +628,7 @@ static void __init arch_mem_init(char **cmdline_p) memblock_set_bottom_up(true); bootcmdline_init(); - strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); + strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param();