From nobody Fri Apr 10 21:56: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 86ED5C25B0E for ; Thu, 18 Aug 2022 21:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343830AbiHRVLt (ORCPT ); Thu, 18 Aug 2022 17:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346619AbiHRVKM (ORCPT ); Thu, 18 Aug 2022 17:10:12 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C667D39AE for ; Thu, 18 Aug 2022 14:04:50 -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=nI+iRX00qYCmfKebiYk1YMkcCnm pVh9OEcgbj9wI/18=; b=0ueGT7Ft9S0dndWyT3y2AcSBW7MI+JDLTiAHlq/r+kN d1iSrjbi1ssDDXcP9V2TIQQLQ1tDUrfJCmb2v53yaoVZsbr4y8zDeCppinS3aK/g Z133z4l6PpcjA2kcWH7EUoShN9YgzLxsZnSXnb8S5eXIsiWGiescgsPAUeS2A7Jc = Received: (qmail 3962329 invoked from network); 18 Aug 2022 23:01:45 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 18 Aug 2022 23:01:45 +0200 X-UD-Smtp-Session: l3s3148p1@BeP5SYrmgoMucref From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Bob Peterson , Andreas Gruenbacher , cluster-devel@redhat.com Subject: [PATCH] gfs2: move from strlcpy with unused retval to strscpy Date: Thu, 18 Aug 2022 23:01:44 +0200 Message-Id: <20220818210144.7915-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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-=3DwgfRnXz0W3D37d01q3JFkr_i_uTL=3DV6A6= G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang --- fs/gfs2/ops_fstype.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 549879929c84..b57d9bf4b123 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -381,8 +381,8 @@ static int init_names(struct gfs2_sbd *sdp, int silent) if (!table[0]) table =3D sdp->sd_vfs->s_id; =20 - strlcpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN); - strlcpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN); + strscpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN); + strscpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN); =20 table =3D sdp->sd_table_name; while ((table =3D strchr(table, '/'))) @@ -1439,13 +1439,13 @@ static int gfs2_parse_param(struct fs_context *fc, = struct fs_parameter *param) =20 switch (o) { case Opt_lockproto: - strlcpy(args->ar_lockproto, param->string, GFS2_LOCKNAME_LEN); + strscpy(args->ar_lockproto, param->string, GFS2_LOCKNAME_LEN); break; case Opt_locktable: - strlcpy(args->ar_locktable, param->string, GFS2_LOCKNAME_LEN); + strscpy(args->ar_locktable, param->string, GFS2_LOCKNAME_LEN); break; case Opt_hostdata: - strlcpy(args->ar_hostdata, param->string, GFS2_LOCKNAME_LEN); + strscpy(args->ar_hostdata, param->string, GFS2_LOCKNAME_LEN); break; case Opt_spectator: args->ar_spectator =3D 1; --=20 2.35.1