Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1018564rwb; Thu, 18 Aug 2022 17:10:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR78mNShOkpD/iIegUTivwWKPgQncO/ToIooDJoa0x222p63JaM+76FgwEi5aDbNj7nIR1q/ X-Received: by 2002:a17:902:d48d:b0:16f:5ce:1d08 with SMTP id c13-20020a170902d48d00b0016f05ce1d08mr4702609plg.49.1660867818931; Thu, 18 Aug 2022 17:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660867818; cv=none; d=google.com; s=arc-20160816; b=ma83HFx9OKC6p346mWdcqKz2HoYDbuaKjyUegJM8N1ZxmI7A0/L7oEH7VUd1lG+uBR S4+X467HNCK2Dz/jztB9SGM5g2GpsxR8QNf0zxWkqB2r1LA+n9Zt4pjbioQbkv0pLmU8 vZYFrJkXXt4AQT3Aq565mp4axNdILp9sa+N1T8vu9cJPM8s814UK0a5ln7VvP25JgERX SGWyTEUlvob+Rj7vl7p22NmmdWr9dGibekOKI4gyMtuK9Mz4ohTyeJi8rYel2gfA+H7M eAqnqj0xSk05um9nOkbDNtfYaLmSmrG46QEBtiv6+ScN0X67z87PdZnY6CXOjzvIW+A/ 7oxw== 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:references :in-reply-to:mime-version:dkim-signature; bh=llML2hYUUrJ+Pc7c5x04IPeWhbm+5QewQ6hmpGNyf44=; b=fvbkQVLit04NU/D4wGM6aK3aRTU1GjqzTtJDaEA4k5OImLvHDoFERfp8owJzQUXOBM cGqDtC0mfvC9FYIsQwSq3shd9QmG2L73NcCnRI9UEBU7mrqs+LEO2yurNBYM0vy1ViQ3 vng8nVQCjt5AV259sXcqarBVmhqKUCJ232MWkQsylJhd5aUt61PYA3gy9E3lBnh6xHw3 8t2DLApr3qbNh02kPqfoflgWkp/7PHaKG4MaknA5Hc/RtW5nJlXUNyQC+nV8F9zVnyZW GLBu9812V3zNfkban7BgtyQxrKc2HnAhmetRtKgagv0+LpycqIJU4Zq+GJcDmNTGEJ3K kjlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="gjg5J/6T"; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020a634407000000b0040d22b45aadsi2422847pga.459.2022.08.18.17.10.07; Thu, 18 Aug 2022 17:10:18 -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=@kernel.org header.s=k20201202 header.b="gjg5J/6T"; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241176AbiHRX1B (ORCPT + 99 others); Thu, 18 Aug 2022 19:27:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbiHRX07 (ORCPT ); Thu, 18 Aug 2022 19:26:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45E32D758F; Thu, 18 Aug 2022 16:26:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB27C61701; Thu, 18 Aug 2022 23:26:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B7BDC433C1; Thu, 18 Aug 2022 23:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660865217; bh=gZgBPW61TBJ2Ot43zC9FdlpHSeteHeF8IwtKZ9jm7m8=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=gjg5J/6TIYsYsHsV8CaVUSv1+hW3RQlbxTfu8rRxi3SRskXUUUJMBnjI2bHeVmqBW WfcRs6tIOlsGCiBgD9JfwisM4jlefyL6Za7zhhJKg3y4Y+RYpRxNgORrQz+IyHE5cv LiSWNkVxa5npvjh9q9BUAqmlgTga+UTnYl0cT6ILEiAhDHqNQLOvpSdtWSWovGTCmT G0EagtnPIkvH8W1DH12NzQcmLQT62oOsGqRXPQUnXBcsrEaxJGJhkK0/fmPR1lCqB9 G8945tT88KMTjQf88X/8eXzqISo82AgEKvm5yDULsWh+CAv1pNeAvzgsYL4xkj+KOq 5P5N16o1MQ6AQ== Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-11cc7698a18so454919fac.4; Thu, 18 Aug 2022 16:26:57 -0700 (PDT) X-Gm-Message-State: ACgBeo3RIE7X62HEphbL3yLiIGyuIxke58G6rpKR1ykubDJ21cUM9OsK S8BWEwBcpE04ke6jRx/lX3lAgnGQEFpAC2YT+Lc= X-Received: by 2002:a05:6870:f69d:b0:10d:81ea:3540 with SMTP id el29-20020a056870f69d00b0010d81ea3540mr2594259oab.257.1660865216257; Thu, 18 Aug 2022 16:26:56 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6838:27c7:0:0:0:0 with HTTP; Thu, 18 Aug 2022 16:26:55 -0700 (PDT) In-Reply-To: References: From: Namjae Jeon Date: Fri, 19 Aug 2022 08:26:55 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 4/5] ksmbd: don't open-code %pf To: Al Viro Cc: linux-fsdevel@vger.kernel.org, Linux Kernel Mailing List , CIFS Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 2022-08-19 5:35 GMT+09:00, Al Viro : > On Thu, Aug 18, 2022 at 03:08:36PM +0900, Namjae Jeon wrote: >> 2022-08-18 11:59 GMT+09:00, Al Viro : >> > Signed-off-by: Al Viro >> > --- >> > fs/ksmbd/vfs.c | 4 ++-- >> > 1 file changed, 2 insertions(+), 2 deletions(-) >> > >> > diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c >> > index 78d01033604c..a0fafba8b5d0 100644 >> > --- a/fs/ksmbd/vfs.c >> > +++ b/fs/ksmbd/vfs.c >> > @@ -1743,11 +1743,11 @@ int ksmbd_vfs_copy_file_ranges(struct >> > ksmbd_work >> > *work, >> > *total_size_written = 0; >> > >> > if (!(src_fp->daccess & (FILE_READ_DATA_LE | FILE_EXECUTE_LE))) { >> > - pr_err("no right to read(%pd)\n", src_fp->filp->f_path.dentry); >> > + pr_err("no right to read(%pf)\n", src_fp->filp); >> Isn't this probably %pD? > > *blink* > > It certainly is; thanks for catching that braino... While we are at it, > there's several more places of the same form these days, so fixed and > updated variant follows: Thanks for updating the patch! > > ksmbd: don't open-code %pD > > a bunch of places used %pd with file->f_path.dentry; shorter (and saner) > way to spell that is %pD with file... > > Signed-off-by: Al Viro Acked-by: Namjae Jeon Thanks! > --- > > diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c > index 0e1924a6476d..bed670410c37 100644 > --- a/fs/ksmbd/smb2pdu.c > +++ b/fs/ksmbd/smb2pdu.c > @@ -3897,8 +3897,7 @@ int smb2_query_dir(struct ksmbd_work *work) > inode_permission(file_mnt_user_ns(dir_fp->filp), > file_inode(dir_fp->filp), > MAY_READ | MAY_EXEC)) { > - pr_err("no right to enumerate directory (%pd)\n", > - dir_fp->filp->f_path.dentry); > + pr_err("no right to enumerate directory (%pD)\n", dir_fp->filp); > rc = -EACCES; > goto err_out2; > } > @@ -6269,8 +6268,8 @@ int smb2_read(struct ksmbd_work *work) > goto out; > } > > - ksmbd_debug(SMB, "filename %pd, offset %lld, len %zu\n", > - fp->filp->f_path.dentry, offset, length); > + ksmbd_debug(SMB, "filename %pD, offset %lld, len %zu\n", > + fp->filp, offset, length); > > work->aux_payload_buf = kvmalloc(length, GFP_KERNEL | __GFP_ZERO); > if (!work->aux_payload_buf) { > @@ -6534,8 +6533,8 @@ int smb2_write(struct ksmbd_work *work) > data_buf = (char *)(((char *)&req->hdr.ProtocolId) + > le16_to_cpu(req->DataOffset)); > > - ksmbd_debug(SMB, "filename %pd, offset %lld, len %zu\n", > - fp->filp->f_path.dentry, offset, length); > + ksmbd_debug(SMB, "filename %pD, offset %lld, len %zu\n", > + fp->filp, offset, length); > err = ksmbd_vfs_write(work, fp, data_buf, length, &offset, > writethrough, &nbytes); > if (err < 0) > diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c > index 78d01033604c..0c04a59cbe60 100644 > --- a/fs/ksmbd/vfs.c > +++ b/fs/ksmbd/vfs.c > @@ -377,8 +377,7 @@ int ksmbd_vfs_read(struct ksmbd_work *work, struct > ksmbd_file *fp, size_t count, > > if (work->conn->connection_type) { > if (!(fp->daccess & (FILE_READ_DATA_LE | FILE_EXECUTE_LE))) { > - pr_err("no right to read(%pd)\n", > - fp->filp->f_path.dentry); > + pr_err("no right to read(%pD)\n", fp->filp); > return -EACCES; > } > } > @@ -487,8 +486,7 @@ int ksmbd_vfs_write(struct ksmbd_work *work, struct > ksmbd_file *fp, > > if (work->conn->connection_type) { > if (!(fp->daccess & FILE_WRITE_DATA_LE)) { > - pr_err("no right to write(%pd)\n", > - fp->filp->f_path.dentry); > + pr_err("no right to write(%pD)\n", fp->filp); > err = -EACCES; > goto out; > } > @@ -527,8 +525,8 @@ int ksmbd_vfs_write(struct ksmbd_work *work, struct > ksmbd_file *fp, > if (sync) { > err = vfs_fsync_range(filp, offset, offset + *written, 0); > if (err < 0) > - pr_err("fsync failed for filename = %pd, err = %d\n", > - fp->filp->f_path.dentry, err); > + pr_err("fsync failed for filename = %pD, err = %d\n", > + fp->filp, err); > } > > out: > @@ -1743,11 +1741,11 @@ int ksmbd_vfs_copy_file_ranges(struct ksmbd_work > *work, > *total_size_written = 0; > > if (!(src_fp->daccess & (FILE_READ_DATA_LE | FILE_EXECUTE_LE))) { > - pr_err("no right to read(%pd)\n", src_fp->filp->f_path.dentry); > + pr_err("no right to read(%pD)\n", src_fp->filp); > return -EACCES; > } > if (!(dst_fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE))) { > - pr_err("no right to write(%pd)\n", dst_fp->filp->f_path.dentry); > + pr_err("no right to write(%pD)\n", dst_fp->filp); > return -EACCES; > } > >