Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp931918rwb; Thu, 18 Aug 2022 15:10:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR7QTZKunK0M14JI+q6sYRHzVpdmyaET6n4gn7+ddSl4Eat2/sxKpVFKab58Ur3HfFJc5VWo X-Received: by 2002:a17:907:3f0a:b0:730:994f:8d57 with SMTP id hq10-20020a1709073f0a00b00730994f8d57mr3014654ejc.538.1660860631098; Thu, 18 Aug 2022 15:10:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660860631; cv=none; d=google.com; s=arc-20160816; b=k0L+nLxRdrxhIF8MtXsmwLfAxYy+llu/OfmRGcUdC8d2fzMgGhwaAjn5oDknuCZ9TX r142d7fY/F/ikobNN1cG4WM9Svvd3Zav8tl/6GxZEBcl5QB8pyRjI3Vy9f3CjzRMzDcC RILid9wizf2emhx+oHurTJfGd/lVRTb2fox0zjT2ha4sdVSsrY3NqojUPZ3x2S66SIvU O2w2avJHG7YArktsqpZ0KQ4br/yHvOy78toUyrISybUpu8Pyae/dDjmp7XSteHvJGwAp FMqjqjiL7un0GOGs8LlHwNaPvCi6LjKpOddM5zNUH8owjcNyFbeSaD9VU2YWzbidlpVL mKuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=rhe9mRJIjYEKwxbWZZXiWC3KccVlD0FV8SeE2CPzCxk=; b=o+ghFZcHx3u0EkOmM0kIaCIWmtSvvhr/11V05XB1w0o9Ek1Ae7WLTeJTDHTiM/sM12 h6RS+tHWhGmfU5yJ+SPA2Ywg6uKRWYWR2V797ehZazmHtWD9zxj7JxiCM0m6LtVtmptf oZnxZ9xOHamnAhgj58IWhDaSZyiyhEBR5OAaSce/7uf7nFy0Vxjpu2p1btM4ZjEQULi+ Xi9MgdGdfCzgSnv2V4YN3JQ9byO3fsC3NT8g3dHQnIw0jlrCM0h5PHiseNfIwLxpGG4a K9Hk6x0aw+vvP6xJKhLVOBdSCV1b6DzJ3WiWgnQRoPDUvGRxpUZGCHo4Hv2TI93+92qM 8b4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=emHQbCQY; 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 n10-20020a05640205ca00b0044628054fedsi961282edx.435.2022.08.18.15.10.05; Thu, 18 Aug 2022 15:10:31 -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=@infradead.org header.s=bombadil.20210309 header.b=emHQbCQY; 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 S242415AbiHRWKC (ORCPT + 99 others); Thu, 18 Aug 2022 18:10:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232990AbiHRWKB (ORCPT ); Thu, 18 Aug 2022 18:10:01 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E882B74DD4; Thu, 18 Aug 2022 15:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=rhe9mRJIjYEKwxbWZZXiWC3KccVlD0FV8SeE2CPzCxk=; b=emHQbCQYIBaojp9O77oJuGSh9t Ha3atEwW9Ozs6ZJi5gNsPgvfANBMXT3YLiX5ddzwgNr/M2fpl6MWDycLqRR8lwYM/IeEbpgeNDaRx ZB7DEXdXrcJyTZ/NQI9wfnMtB1Hq2oDOL2X6DUh0A3JuevdWF1NGZN0JtJuWhT9lTs7mYMwCmJPKv gkfeIONW84YV0a+MQmoE1qgTfGtMtH0lVbCE6DkQ9fP7/c6UT6+0IzECvJpaQ/9Jd2UIwGrwXfxSO jr3tvRYeCw0SOjLF5SrbpJHjbr3bxpWiwugWRQB7FcM2LXZKLY28nSn6e4dtckefAEG+mktoc3miB kggujMOQ==; Received: from [2601:1c0:6280:3f0::a6b3] by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOni5-00AGgL-RJ; Thu, 18 Aug 2022 22:09:54 +0000 Message-ID: Date: Thu, 18 Aug 2022 15:09:52 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] Bluetooth: move from strlcpy with unused retval to strscpy Content-Language: en-US To: Luiz Augusto von Dentz , 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]" References: <20220818210207.8323-1-wsa+renesas@sang-engineering.com> From: Randy Dunlap In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 8/18/22 15:07, Luiz Augusto von Dentz wrote: > 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. Works for me. >> 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 >> > > -- ~Randy