From nobody Fri Apr 10 21:56:01 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 B4E79C00140 for ; Thu, 18 Aug 2022 21:13:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346961AbiHRVNH (ORCPT ); Thu, 18 Aug 2022 17:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346789AbiHRVKc (ORCPT ); Thu, 18 Aug 2022 17:10:32 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48398D8E28 for ; Thu, 18 Aug 2022 14:05:22 -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: 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 --- 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 *sess= ion, struct hidp_conninfo ci->product =3D session->input->id.product; ci->version =3D 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 =3D session->hid->vendor; ci->product =3D session->hid->product; ci->version =3D session->hid->version; - strlcpy(ci->name, session->hid->name, 128); + strscpy(ci->name, session->hid->name, 128); } } =20 --=20 2.35.1