Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1207391rwb; Thu, 18 Aug 2022 22:18:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR4SrBL5WgSUMKJIqw8iWprNzVwyo9rhrilLwOBZlRIe6IaW1xtnLHlZIOWW1pN8EQ/hNc68 X-Received: by 2002:a63:5a4d:0:b0:41b:7702:635f with SMTP id k13-20020a635a4d000000b0041b7702635fmr5113749pgm.111.1660886304820; Thu, 18 Aug 2022 22:18:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660886304; cv=none; d=google.com; s=arc-20160816; b=J98Bgvnh5UsvJ+5pZbFyXAN9R9LsnvRSgoLTzs6+HyiUNfe1buL1B7olYJLIbO/MYv QrczFSJUuXusL5e+mHTRjtsMV15LaeDV3Yt180AOmkqA/jj6PEmKhkEQX0XtjpsP5yq1 pd2y/ThtR4zArf5U20Eu8+tEsCnr37oA3VgHQfYPBWKOvVCdHy2gJj1mmXGVte1BOuwe 8Ms3cmm22KiKvX7SO1O+XItniQiU1igDUJZcw5ZjcRkWECgWbA1Vkjk6WwU5EzDPVuCi oQvK2g6khuWyIJ7eDNcapKOEOx7bko3KOEL1SkIDdU+VPGof/nyXDQN7z1s5AM0EFYKT SvQg== 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=0KoTScIC7XKvx310KN0v9F7ZwulzGHm2HwEwg7svJe0=; b=hBdkgDpYgl19lOSw74P+e842Jr66w6Ujj3qr/FV+U/Fz1m1whULfBCXFCN4V+Vwi3v UoTJbAN45HvpZ+IUaCL06s0Ddw/2r/zT+pJrrkgurQ5wURHtvvli6aMOWeDujUw/LDZ+ MChZECI+njHQxfcW5z3BZ+lWf24oT6doHCZ4Ovq+zQDn2cr3efaWSfubE1vNd6fauQNE 2QagX9ih4iE586gXHLLlUUY0UQbT4VYxV/zDGBs3sz5duBcO5joiOoHrZa9wAQG+C01D 9breWyOJ8h5iKrkvSpWzqWRf70+C9u4xScFs/NQJYNDvaJb9Ylcswxsv7E+VOaDgwJ2N OGvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FdY8v7jr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 oj8-20020a17090b4d8800b001f1e89b256fsi57789pjb.144.2022.08.18.22.18.06; Thu, 18 Aug 2022 22:18:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=FdY8v7jr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S233617AbiHSFAs (ORCPT + 99 others); Fri, 19 Aug 2022 01:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230077AbiHSFAr (ORCPT ); Fri, 19 Aug 2022 01:00:47 -0400 Received: from mail-vk1-xa2f.google.com (mail-vk1-xa2f.google.com [IPv6:2607:f8b0:4864:20::a2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 582C11DA6E; Thu, 18 Aug 2022 22:00:46 -0700 (PDT) Received: by mail-vk1-xa2f.google.com with SMTP id b81so1773737vkf.1; Thu, 18 Aug 2022 22:00:46 -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=0KoTScIC7XKvx310KN0v9F7ZwulzGHm2HwEwg7svJe0=; b=FdY8v7jr0moe/4RznEj7CYmQBDRzeerk4eAozh/OA5/dQiYzCdAVa/K2ethdYrjbb8 v2ZHM2FldV5wp0ZwVogkTZSliZszKhxQ0YG1Z411fZJ+dojjIuvYJPJr1a3l4fyKa21H 8QMDI8y4Wu3eJndEHEH1kVEuwOOBu56kbKR7YEZL+liZE+8I6DzfyQ2ItSUWn/b1U3/k UuKpZ7jSipyt7yJwONR4zAXQhi05i9zUNLiQ1wnZBPwvTm9sE6E2yPFU+rHJPBJDAkR6 2uWyQ7X3Fh1vzRNGY2M6mmh+pX/cGFJE0iK6qsJd97tuA2B2W5ETsfOMA9VDHfH6YhXi 0QFQ== 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=0KoTScIC7XKvx310KN0v9F7ZwulzGHm2HwEwg7svJe0=; b=mewaDKYRJWDpPgT5MoIn/T48d6FD2a1NGdHisaMDVr2xWkmNGsum/kAtInNzwzVrxj rVOMCyKVq9ge7SvELwHsWKnGXanwd+AiOkCNaTkLHLcDdWrgJR+SqpSvLuEfV5iWol5j cqCs4iuB7NoV7Z2JYBcmU3nvzXJ+RWYvKKfYJvxFA5WFOYAJs49IVV5VwhXKVVMD0nKa cpPLDMq9B6bj/yCNmYlwqwK2SNGDOyF7FMbuQVeIqUABXO6ETprNzlpbyhSYxOVMvyJY ACnP7VJ4S+EXFKeY3NUWj0+7B9h8Y7pYqTFakw+xeAhjpi30K9ME/4t4ijC0GMSow/O3 wuMQ== X-Gm-Message-State: ACgBeo3DP6mSbkdX99FaDNqZ6vbdT6e6ZJweG+h18edyEkSyPimIbsSn adpbeo2BayVwaDFHfbKqpRqdgh/logYUkvvpwzY= X-Received: by 2002:a05:6122:311:b0:383:2f10:47f6 with SMTP id c17-20020a056122031100b003832f1047f6mr2308991vko.3.1660885245104; Thu, 18 Aug 2022 22:00:45 -0700 (PDT) MIME-Version: 1.0 References: <20220818210142.7867-1-wsa+renesas@sang-engineering.com> In-Reply-To: <20220818210142.7867-1-wsa+renesas@sang-engineering.com> From: Steve French Date: Fri, 19 Aug 2022 00:00:34 -0500 Message-ID: Subject: Re: [PATCH] cifs: move from strlcpy with unused retval to strscpy To: Wolfram Sang Cc: LKML , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , CIFS , samba-technical 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-kernel@vger.kernel.org Looks fine. Do you want this merged through my tree? On Thu, Aug 18, 2022 at 4:11 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. > > Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ > Signed-off-by: Wolfram Sang > --- > fs/cifs/cifsroot.c | 2 +- > fs/cifs/connect.c | 2 +- > fs/cifs/smb2pdu.c | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/fs/cifs/cifsroot.c b/fs/cifs/cifsroot.c > index 9e91a5a40aae..56ec1b233f52 100644 > --- a/fs/cifs/cifsroot.c > +++ b/fs/cifs/cifsroot.c > @@ -59,7 +59,7 @@ static int __init cifs_root_setup(char *line) > pr_err("Root-CIFS: UNC path too long\n"); > return 1; > } > - strlcpy(root_dev, line, len); > + strscpy(root_dev, line, len); > srvaddr = parse_srvaddr(&line[2], s); > if (*s) { > int n = snprintf(root_opts, > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c > index 9111c025bcb8..3da5da9f16b0 100644 > --- a/fs/cifs/connect.c > +++ b/fs/cifs/connect.c > @@ -3994,7 +3994,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses, > } > bcc_ptr += length + 1; > bytes_left -= (length + 1); > - strlcpy(tcon->treeName, tree, sizeof(tcon->treeName)); > + strscpy(tcon->treeName, tree, sizeof(tcon->treeName)); > > /* mostly informational -- no need to fail on error here */ > kfree(tcon->nativeFileSystem); > diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c > index 9b31ea946d45..9958b5f1c12f 100644 > --- a/fs/cifs/smb2pdu.c > +++ b/fs/cifs/smb2pdu.c > @@ -1928,7 +1928,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, > tcon->capabilities = rsp->Capabilities; /* we keep caps little endian */ > tcon->maximal_access = le32_to_cpu(rsp->MaximalAccess); > tcon->tid = le32_to_cpu(rsp->hdr.Id.SyncId.TreeId); > - strlcpy(tcon->treeName, tree, sizeof(tcon->treeName)); > + strscpy(tcon->treeName, tree, sizeof(tcon->treeName)); > > if ((rsp->Capabilities & SMB2_SHARE_CAP_DFS) && > ((tcon->share_flags & SHI1005_FLAGS_DFS) == 0)) > -- > 2.35.1 > -- Thanks, Steve