Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1280827rwb; Fri, 19 Aug 2022 00:18:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR67lOk6wsbCZAVdBVdvVNNhV4UZhvAzDeyY4Mvy1ffmIO+MuQmhMqI/P3qi+ce4p01IKKY2 X-Received: by 2002:a17:907:3d90:b0:73c:83de:eb82 with SMTP id he16-20020a1709073d9000b0073c83deeb82mr2221957ejc.343.1660893493857; Fri, 19 Aug 2022 00:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660893493; cv=none; d=google.com; s=arc-20160816; b=ozUKM98Gx7qz0kD4tFNLOiALePHFmo/6HbJdj0GYqApL0/28n3tOU3UjLkrIhA/loX baYZt452irXHGOpMyfrc5Fva/O4s7/R5FK5nChij4SoYWPHkluzVAdOJ9g2Kd7Mq6r42 TI3mJTAf24lpgPcpY9VRgjnV/4g6CBgbU4AVtgGmczGHjQv7ym+n0CeB3OngbUHFISMQ LEZxaQRTB4GDQr1GPJI22hlXPcrahiKgHfUhmeSFQmXdfWjn6C01PabmEwSUgxo3ZsyE JW5W1KUPoaN8eBedLy2Da5Mnyfg2lsCG5uey4CIgO4wbtjN9aAhhc0BdmucIm3S+xF6L gLOw== 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=0MSWc7wdb4JmTnyiY3TNYUbqrM+fW7halymViKhckH0=; b=J8fCpeW8nLewisRbZkEQ8MbAu4DfaYx2dgRjTqcI66J6bZsInXGamANwO+i4qEh2Rq OP/s6ZrpC4qW/PyBBkDgmlCoQiWX74XodNEo48iqBQTk2kSK8/ljyfhhTq1VTSkotfNP fzA0QmkeLWlqnZekc5sg54rpIH+RtS/oQovRJI/BaTvVdoJJ1CldoeLBwKIqS2Qgr0bz WitOl1kMnmTSuVMc5d3G/CnFqH/yRH5FSYUw2pix+b/fW+dzn2IRMLw/O9HYf5Ng1CHB em4pDduTS6YRzcO/CSXoTWyss2AUIoUGpb7MPzupzgu03YxIygrXSd0g0CkYVaszTpWD NH4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ldS6CT+C; 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 d3-20020a056402516300b00440072d0ae3si2417670ede.196.2022.08.19.00.17.47; Fri, 19 Aug 2022 00:18:13 -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=ldS6CT+C; 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 S1346625AbiHSGU3 (ORCPT + 99 others); Fri, 19 Aug 2022 02:20:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345865AbiHSGU1 (ORCPT ); Fri, 19 Aug 2022 02:20:27 -0400 Received: from mail-ua1-x936.google.com (mail-ua1-x936.google.com [IPv6:2607:f8b0:4864:20::936]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08BEE60686; Thu, 18 Aug 2022 23:20:27 -0700 (PDT) Received: by mail-ua1-x936.google.com with SMTP id s18so1448984uac.10; Thu, 18 Aug 2022 23:20:26 -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=0MSWc7wdb4JmTnyiY3TNYUbqrM+fW7halymViKhckH0=; b=ldS6CT+CSIK1ONsRd4HFvX5zLNhbwOSmfYXGXtouMr+obCzSyvKuevfrvhdq9568Tf rfa6MxqeABVgMEcTGyshxoXuxXa9gl4AuwAaPLNZ3ekA0qZKoig9MT8Go5qMKM0vtu/K uR6ifXy80K0kwL3BXvLdZnJiY+LiGdkInUmrd3D1WtZaOvhhare2mc707N79qXaHATAA sDsEORXOqx8O+GCqes40t2SC+n8f82bIjnV9w30Jwr3Id/5O54G1eDQV8ebxdKEsKdwz UHdZaGW09CuOHSCJ6ZA2LD7GHZ3ICNYjW4k9XSi2AYnK4ADMLbiKN8IbpslU7chE6epU dwNQ== 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=0MSWc7wdb4JmTnyiY3TNYUbqrM+fW7halymViKhckH0=; b=ExgFVR0H9aNY8KJYfyuWcelPfVZCQMXsJeuxzG/2EP0lQGfQEwaL1UmXB0j6+MNp/m sXOsjbsWn6ee/D918nRAh8QcgG5+SMSF7/CKuFmymaINi7NJ0i844AARYF7w9HdHa/fp kPaZz8KuVNC/AKKv1dL2f9DMIWbqQqJ3MvheN33Nv8PL4ncVRvDJ2HXMz85nnCLm+l+C J/PkwI6c0tWnXeqhoLDBpkW5UeRd38DNrlCg40agv+vlbtlVs1MJdNXWw9Fdkx8CEjJ/ KEdWSAuTpgpzXZYm1B+5kVXlDP3RCtpW3SNiyyttMNPjUq0JdHGltHKKO74t37zeCmHd GHrg== X-Gm-Message-State: ACgBeo0kOJezQRQCkRyHLzB2P5YY+MxA3Aho96r5jKNPUwQFsYrsCFNY 3sO+23hCBOWjeCNF+vRHxJe0h/rErHUeVZP2e8w22hg38nc= X-Received: by 2002:ab0:3bc6:0:b0:381:c4db:ef5 with SMTP id q6-20020ab03bc6000000b00381c4db0ef5mr2542135uaw.81.1660890025731; Thu, 18 Aug 2022 23:20:25 -0700 (PDT) MIME-Version: 1.0 References: <20220818210142.7867-1-wsa+renesas@sang-engineering.com> In-Reply-To: From: Steve French Date: Fri, 19 Aug 2022 01:20:14 -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 tentatively merged into cifs-2.6.git for-next pending testing On Fri, Aug 19, 2022 at 12:00 AM Steve French wrote: > > 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 -- Thanks, Steve