Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp931769rwb; Thu, 18 Aug 2022 15:10:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR7MiGuY8P5AaXChyAb1/9ta3h61gojT61IMqmSVmdFeCcq9sQ/C5o0wuckvw3Kg8GNVDjdL X-Received: by 2002:a05:6402:388e:b0:43a:d5ff:60f0 with SMTP id fd14-20020a056402388e00b0043ad5ff60f0mr3649473edb.152.1660860619841; Thu, 18 Aug 2022 15:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660860619; cv=none; d=google.com; s=arc-20160816; b=Dz+jXbsYlinkEmvJLmFr8gC3QmokTGjnBicCTnGaR5M8QxW6ZJUU8vm3JFKI2+BRJg CeXGPpx15Nc4wNOL2TkcHDzZSQFpdQfgwxZ8ugJhSz8+8vKTlmF7YkOavm7yd2BlldFg jTNWJWUb5fqMpHHoPj0+Tf94jCYCrl/S+zHRzNVbOaACwi0L7DvbwCD1Z/MwzGUjjv+j qtTo7Qh1xOPGecGb6rZlMQkFCjn5+KxuVOAn8U3b2T5xGbdwtVsQ+eyK/2sceu5ClVJ6 FsWHYiuLkQXxU6zCDhpkPbn/OqlUyhFiIPhcgcKhwm6L4kyDXD1VnG8aTuA35yOVj2iO OUCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+yl8RAHKGrw9azpH8jGfAjFkV6Z6RsFEnaQjPufoQPA=; b=Jrbc5rVwKH/eLipNy6D1crCA9xV9xcpdR2hXa3xLb8pGs1s28kMw9MVmAoHcik8okc mPkdfJpb2ByWKtUuOYi05ig1vbx0cXvND2z4ue8OZz7UR3eKiFBjCkfm2lYusLQFTqeP AJ/xamTugO8eePHYt7NRRPS4Aivak43S7ro04b2H8d2Hplq6t4vve/CMlzjV6Qofi6TK 9HhTyedKTDCwszLBSvaYgvo2AdTo+IkcLWpgJLA4YNKe/IDuSXbcu9adkl7Fii1S9w/X +vwqyV7NWAU5ihNvSI3qzmZ9iThPGnzuWqK02RbSaImCTThAJlQ4ZIKOgu3hpOrAXC6E 1Ztw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cN5F6Qsl; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w16-20020a170906b19000b0073872f387f1si1700160ejy.244.2022.08.18.15.09.53; Thu, 18 Aug 2022 15:10:19 -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=pass header.i=@gmail.com header.s=20210112 header.b=cN5F6Qsl; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343845AbiHRWIK (ORCPT + 99 others); Thu, 18 Aug 2022 18:08:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344516AbiHRWHy (ORCPT ); Thu, 18 Aug 2022 18:07:54 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BF2AD31FA; Thu, 18 Aug 2022 15:07:29 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id l1so3323965lfk.8; Thu, 18 Aug 2022 15:07:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=+yl8RAHKGrw9azpH8jGfAjFkV6Z6RsFEnaQjPufoQPA=; b=cN5F6QslIcwGT6/dfOprpGCV5dVAvcXHysxqBMyCu/jmn57/4WS3DHrGdVXI6SXOHu hhL3jZlaLj8fyM01SYuKS9X32lbjuW54Daytwq5HFx6qxt/BG4EHMa2h/UCPIPblr9k8 KuWrUaf7wjcFeCgqgPByTJWiaaLE/bJxw86UF2zZjvaEoq8LbnmYoyZ29BSKiuBX1zVf TETkMEfA54mFwyYTTIv3oHNXGdx+1hVAb65da6BvzL5WrxMy1aMjhpsfDcHyyyW8hStZ yJ7DfNnDgxxcHmm0yMz/Mknw2krIkZGBmcOB2mJDtsibIm1+p9wvFVEAOrNjCaT8Emha q5eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=+yl8RAHKGrw9azpH8jGfAjFkV6Z6RsFEnaQjPufoQPA=; b=md5DtfKp6ZL8+oy43rbhrLBZZgwZjiQXgwtwcrLGtMfb5SPw1g14rD87d2IC76Ojf/ Nxxa1a51eVwSZOFhDW5W2l9xq5kRXf3Qvobwz1C3PgcjDiPp/i/Jodhfy0Lu6yrR8fEy tljUGpxITC0CT8Hbjcw+A50pXsNiJjDdr3g4YkmPOxaAAn7S9S7OX4T3RqTkrFmR4vHS PNyKFPzvYQ9v+QdjOgEDgNGC9DEhRlucPeu4qB6yF/mlO7lcqd7ZPbFHbv9IChrPRhh2 +36QJkBEdKK85g/p3eg6+YXrdJNmCF6cDNSXmiBqYbFP1Mf0Q30LBcd25VFyl/mdtWdI l3Ig== X-Gm-Message-State: ACgBeo0LeofyOahOPMtF8nATpooeskulyHztwVnPtcI4c0/0jPulU/cR FzUfXu2aMgt3UiKHULACq9ewZERebV/sHQc9f4I= X-Received: by 2002:a05:6512:3fa8:b0:48c:ffd1:625d with SMTP id x40-20020a0565123fa800b0048cffd1625dmr1378923lfa.251.1660860446956; Thu, 18 Aug 2022 15:07:26 -0700 (PDT) MIME-Version: 1.0 References: <20220818210207.8323-1-wsa+renesas@sang-engineering.com> In-Reply-To: <20220818210207.8323-1-wsa+renesas@sang-engineering.com> From: Luiz Augusto von Dentz Date: Thu, 18 Aug 2022 15:07:15 -0700 Message-ID: Subject: Re: [PATCH] Bluetooth: move from strlcpy with unused retval to strscpy To: Wolfram Sang Cc: Linux Kernel Mailing List , Marcel Holtmann , Johan Hedberg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "linux-bluetooth@vger.kernel.org" , "open list:NETWORKING [GENERAL]" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hi Wolfram, On Thu, Aug 18, 2022 at 2:05 PM Wolfram Sang wrote: > > 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. The link below doesn't seem to work. > 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 > -- Luiz Augusto von Dentz