Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp887916rwb; Thu, 18 Aug 2022 14:12:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR71dk71l9l1A7tWDP5SZdCLJgL91cViA7wFXXSC1CkrVTxU2hVoQMUPTt4hQa/ilmRlUWwP X-Received: by 2002:a17:907:97cb:b0:731:6d1:13fa with SMTP id js11-20020a17090797cb00b0073106d113famr2932476ejc.375.1660857161935; Thu, 18 Aug 2022 14:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660857161; cv=none; d=google.com; s=arc-20160816; b=z9TlZ3OxETDpFfAgsA+oeH9poSIBh6yruYqyKyjfYm51ENTrZAjTc+uhBX45mTSuDP JCmhhobh/paLkhj0u43NlXuK6agnpQvqqqj3lY3wcjKlWy7F505GKHYI2pzik9g9qd2U SV3ySzQJ7U/G2WXVb455BrPguKSMIpasdFuLWm/6qH6QLj2JyF/NkoTe0jvw/UDUPTDy gPIfZahlwyzncedt5zzvg1HQCMmXVPFV4oJeerw6iblTo02uwxSoLm1MyqvVQjCHefDA QjIATeBTpqdRcIhKCWWtj0m7BX5xGp7TUi5zJsPXX2lxs/9Ea0UnKolHsm/G3VpDIvCP uAGQ== 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=eAIp31u8uFSIeJ5wED9SASepAXxu1UkzSNH9HOOQNFY=; b=wqdYohGuf1LpzhTE97slRnwUKzhqg4yVSEdDXAHtMYsRAVO4/dXJzIp22qs6wm+U+q w6875fWh0iAIhTk/qDY06nyPwjUerhPbCvrcPB7DwLUIuq+eHRuyd6uw04npnbHwAIpq EsXyu1HjBrvrd3XywbNZuJqojVgFr6NKa4m/BQXkhvdvaDhMSJFoIiFyK4ouESL8N8i6 /xoGEBZdFsozpMofKBS+UOy4fslN9w8fPFGVii8c+og+pdkkjGuSZLO5gXc/hosmKF28 kDcAPdfbR3YtJU44SNC6uBVZO7keBmmlAhi6kjJfQFGev0SjBEu37dQM5Fda1V8Es8gg x8Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=thQDPgwc; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-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 o16-20020a056402439000b0043c96460dbfsi2224105edc.62.2022.08.18.14.11.54; Thu, 18 Aug 2022 14:12:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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=thQDPgwc; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346683AbiHRVLY (ORCPT + 99 others); Thu, 18 Aug 2022 17:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346811AbiHRVKd (ORCPT ); Thu, 18 Aug 2022 17:10:33 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFAC0D8E32 for ; Thu, 18 Aug 2022 14:05:24 -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=TQvfnxXZQIf/nuT7d96mLzgYq4A i5a80rJh06Rtv+LM=; b=thQDPgwczT4zztbVjGDJO4zSQxnTz9qIl1Iptx5gY67 zi3NoeicHDzAgW/zb3NZAt3ZpLp5ChmrUE/G/t0uAFxrPVQrk7B4r5lY5bwoIQ6O QO801GKQrmq4CNZcQbF4E5vgA6j8uBlmGBx2ewSOosKsjC8Zn5CABgrPO5yYyNxA = Received: (qmail 3962958 invoked from network); 18 Aug 2022 23:02:12 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 18 Aug 2022 23:02:12 +0200 X-UD-Smtp-Session: l3s3148p1@vA1WS4rm0Mkucref From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH] Bluetooth: move from strlcpy with unused retval to strscpy Date: Thu, 18 Aug 2022 23:02:07 +0200 Message-Id: <20220818210207.8323-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-bluetooth@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 --- net/bluetooth/hidp/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 5940744a8cd8..cc20e706c639 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -83,14 +83,14 @@ static void hidp_copy_session(struct hidp_session *session, struct hidp_conninfo ci->product = session->input->id.product; ci->version = session->input->id.version; if (session->input->name) - strlcpy(ci->name, session->input->name, 128); + strscpy(ci->name, session->input->name, 128); else - strlcpy(ci->name, "HID Boot Device", 128); + strscpy(ci->name, "HID Boot Device", 128); } else if (session->hid) { ci->vendor = session->hid->vendor; ci->product = session->hid->product; ci->version = session->hid->version; - strlcpy(ci->name, session->hid->name, 128); + strscpy(ci->name, session->hid->name, 128); } } -- 2.35.1