Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp899043rwb; Thu, 18 Aug 2022 14:27:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR5x4v4v6fI0zOdGsApVl3SEBlvhmLEm+O2vK8+I/tAYRSJqlEi1eYd7QM2LGIVXDVEphyIy X-Received: by 2002:a50:ec91:0:b0:440:9719:72ca with SMTP id e17-20020a50ec91000000b00440971972camr3586223edr.407.1660858033460; Thu, 18 Aug 2022 14:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660858033; cv=none; d=google.com; s=arc-20160816; b=OWgXww7OO56BKN4TsqKVvoB9+Wd+q6maQ3YyqJVby9iOytHGBqPxA8DW5mE4D61Obw QlEkAIXC+GgBnff37uKvLeYUcTaDfXlN2ATSIENKAZ2IQMeIaPeJQ1zLzfnWeLcmu6n6 fcehVLMDqJWcMkJbwaaZ1S5bhkney8QbhmK0QOk1fO2TeXAACQFUAcsBbprui5j1YcJi OMj9vrpFUCq86szEWCldeX3iaja7h6yPnjI466quzvh4rvR4x2mPWHk6aKzscHmaFr7z SDDpXDs1zGz3Q0Ld3lSGXtMAANA5yDF9j2no9CwavAJL34dqChPQwpWImHd/tHQU4J6K cV+A== 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=BALyYlyUXRW32cza2MU6Q1Wj8Db/ELd+XO36iFON2lY=; b=Ckb0ROHneRIGVgaUSENQOJ4qJcsikyifn+KYk3vEyYQpSb0Q0iKccGdl6hilFloMEp CKQ6kn0Y9QoaFPI7IsFtyUmX9m50LXDXL/ADkkOg2ZoaguNpud4VDSa9uqvc3/pYgfnD sIxfIb5twqbw/+UAlMfeSICsvehSgvQLRwKOzQRW5kSCbPauOPeuiZxRzuHjZVC2LO7i o9B4SHQSWKVaU0X+y/0Wwsj+sk33nV//EJEdFEM045gmYjKH7Y9C4/dwy/mOT+eKjFkr 0CvBS/K0tBnvmlCHYIa5Y5U/XOIy9G7InCb9bJEyt4wQ7dQFCr5w6w6JCe0yOQ1sC3HM fK+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=0ueGT7Ft; 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 s13-20020a056402520d00b0044066d82f6dsi1911765edd.21.2022.08.18.14.26.47; Thu, 18 Aug 2022 14:27:13 -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=0ueGT7Ft; 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 S1346855AbiHRVLr (ORCPT + 99 others); Thu, 18 Aug 2022 17:11:47 -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: 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 --- 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 = sdp->sd_vfs->s_id; - 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); table = sdp->sd_table_name; while ((table = strchr(table, '/'))) @@ -1439,13 +1439,13 @@ static int gfs2_parse_param(struct fs_context *fc, struct fs_parameter *param) 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 = 1; -- 2.35.1