Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp876586rwb; Thu, 18 Aug 2022 14:01:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR5GZYUCuJl1E65It8akn/676jkoMZxad/FrvWPGbcPXT7bqGLoM2hNHhCKnL7JAUUyiFw6o X-Received: by 2002:a17:907:c0e:b0:731:614:e507 with SMTP id ga14-20020a1709070c0e00b007310614e507mr3007375ejc.529.1660856519627; Thu, 18 Aug 2022 14:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660856519; cv=none; d=google.com; s=arc-20160816; b=svQrdgLBEe5af83z2pd6rmha9nZ7lK/02nU9sVAfgFeot0Mku1Edvy1EBkJEFl8Efs tu6xxOjdUrM8H/zX+p2tI5R1YfJttMH6pe9bnxgCWP/zyIbmeYpbDQ0Q/7X4AmTz/L9q +pPi9MgCC0D02jzZEXDxdtkMSoUHb6SNidCkfwuWkup7+f9H6W0f2QjIh0LDKjZD1dxF VOtvt5nogWN3miBgYpAcp2k7BSb6K2PgO+Jys2af+j7JoSFkeG+AGHX1+HmOD1cTR1gJ 7BSAV5Gt1y+Jzdtb0uuhanwje+k3fmzSyEmXqNNFyIldws77itl4Tj1XetjKQw3AC+Vq tR2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aIgNqzxJ4USaO2hHl8ZDMDKsn8u3nmxjvMr+Z5p9FgE=; b=IL2QLi87Z+uvXHkNPEXu8MQ9f7FtV0KI2zY0ebDs9lO3JClU1Ukfvv9ydD5ONC8C/Y Q6e68q5CHb6CGeWyKM0BsTR5WwW4CoTyYLRiohrdXTnbepcqvFAiWHt8Q6UQ17s6mtPF EIfHA/e+QjFhEM8ICosMXqsMWDFVvaXfm6WJ/0fLBF+2HWVskMaGELfyPxgaVt/F2Y0s WihPyRVRHAldiD5t4KyMC9fOu3MrdyH+V4ca7yUzwN3ln9M5LZ4b2gDXo1liZsid8W9j VQhfkJnBH5It0Ov4L6+ANpe3MvJAJ/rUAnRZaFE2qDmiTv2wIICh7f1+z/lKzVnzZdrZ +psg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=XDdhPx3n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w11-20020a1709064a0b00b0072a51fa07a2si1558313eju.296.2022.08.18.14.01.32; Thu, 18 Aug 2022 14:01:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=XDdhPx3n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346177AbiHRVAF (ORCPT + 99 others); Thu, 18 Aug 2022 17:00:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345906AbiHRU7r (ORCPT ); Thu, 18 Aug 2022 16:59:47 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E5B9C927B for ; Thu, 18 Aug 2022 13:59:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=k1; bh=cqD705fFTh316hCyGQwFS4+QgtX FHmPg3Q2wWOK/wt0=; b=XDdhPx3nVnwDme9TOix/BRQVkDFoOSTM4q7MsRrbJia dH8tgwAWSYXXIUNjxZn1XGaLSoT+K2/RfSctBG8opljHeMXexVrFK1uE9L6tBAx0 YCULZayhTVE9ZEq3adyaJybNju3TVdcVvch4ZWRSg7e/VqMkf/FPr+1x7SAvTl0o = Received: (qmail 3959067 invoked from network); 18 Aug 2022 22:59:44 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 18 Aug 2022 22:59:44 +0200 X-UD-Smtp-Session: l3s3148p1@DxnPQormqIAucref From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Thomas Bogendoerfer , linux-mips@vger.kernel.org Subject: [PATCH] MIPS: move from strlcpy with unused retval to strscpy Date: Thu, 18 Aug 2022 22:59:43 +0200 Message-Id: <20220818205943.6288-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang --- arch/mips/kernel/prom.c | 6 +++--- arch/mips/kernel/relocate.c | 2 +- arch/mips/pic32/pic32mzda/init.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c index 7db6ff9aed7d..f88ce78e13e3 100644 --- a/arch/mips/kernel/prom.c +++ b/arch/mips/kernel/prom.c @@ -26,7 +26,7 @@ __init void mips_set_machine_name(const char *name) if (name == NULL) return; - strlcpy(mips_machine_name, name, sizeof(mips_machine_name)); + strscpy(mips_machine_name, name, sizeof(mips_machine_name)); pr_info("MIPS: machine is %s\n", mips_get_machine_name()); } @@ -52,9 +52,9 @@ int __init __dt_register_buses(const char *bus0, const char *bus1) if (!of_have_populated_dt()) panic("device tree not present"); - strlcpy(of_ids[0].compatible, bus0, sizeof(of_ids[0].compatible)); + strscpy(of_ids[0].compatible, bus0, sizeof(of_ids[0].compatible)); if (bus1) { - strlcpy(of_ids[1].compatible, bus1, + strscpy(of_ids[1].compatible, bus1, sizeof(of_ids[1].compatible)); } diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c index 56b51de2dc51..58fc8d089402 100644 --- a/arch/mips/kernel/relocate.c +++ b/arch/mips/kernel/relocate.c @@ -340,7 +340,7 @@ void *__init relocate_kernel(void) early_init_dt_scan(fdt); if (boot_command_line[0]) { /* Boot command line was passed in device tree */ - strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); + strscpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); } #endif /* CONFIG_USE_OF */ diff --git a/arch/mips/pic32/pic32mzda/init.c b/arch/mips/pic32/pic32mzda/init.c index d9c8c4e46aff..08c46cf122d7 100644 --- a/arch/mips/pic32/pic32mzda/init.c +++ b/arch/mips/pic32/pic32mzda/init.c @@ -44,7 +44,7 @@ void __init plat_mem_setup(void) pr_info(" builtin_cmdline : %s\n", CONFIG_CMDLINE); #endif if (dtb != __dtb_start) - strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); + strscpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); #ifdef CONFIG_EARLY_PRINTK fw_init_early_console(-1); -- 2.35.1