From patchwork Thu Aug 18 21:02:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 12947971 X-Patchwork-Delegate: kuba@kernel.org 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 A66E2C25B0E for ; Thu, 18 Aug 2022 21:11:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346893AbiHRVLw (ORCPT ); Thu, 18 Aug 2022 17:11:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346887AbiHRVKn (ORCPT ); Thu, 18 Aug 2022 17:10:43 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C76D9D64 for ; Thu, 18 Aug 2022 14:05:51 -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=FdaUJeIEV2CT+N9Kxppdll2RzT0 QxnXiF87i4MGOtBI=; b=S/CaRL62H0ZouGQ+W5Q5Kh+O31tUhcqYMEk2Rx2N+Im 8M5iBqc2BMb+i8PpFFGgjr1CvUYD3nSXURNL+rL2POpyX7x0IQA1UlluRFRtV6bp EzZjSfBAY/YMgAYFIcjAVX0Ihxk9k18B8pOJYgSDkzrVhE8uziThRZHM5YVhvdX8 = Received: (qmail 3963328 invoked from network); 18 Aug 2022 23:02:29 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 18 Aug 2022 23:02:29 +0200 X-UD-Smtp-Session: l3s3148p1@nvyaTIrm5L4ucref From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Subject: [PATCH] net_sched: move from strlcpy with unused retval to strscpy Date: Thu, 18 Aug 2022 23:02:28 +0200 Message-Id: <20220818210228.8635-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 --- net/sched/sch_api.c | 2 +- net/sched/sch_teql.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index bf87b50837a8..5b229c7e0065 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -194,7 +194,7 @@ EXPORT_SYMBOL(unregister_qdisc); void qdisc_get_default(char *name, size_t len) { read_lock(&qdisc_mod_lock); - strlcpy(name, default_qdisc_ops->id, len); + strscpy(name, default_qdisc_ops->id, len); read_unlock(&qdisc_mod_lock); } diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 6af6b95bdb67..1f447b77ce84 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c @@ -492,7 +492,7 @@ static int __init teql_init(void) master = netdev_priv(dev); - strlcpy(master->qops.id, dev->name, IFNAMSIZ); + strscpy(master->qops.id, dev->name, IFNAMSIZ); err = register_qdisc(&master->qops); if (err) {