public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@hammerspace.com>
To: "anna.schumaker@netapp.com" <anna.schumaker@netapp.com>,
	"trix@redhat.com" <trix@redhat.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] NFS: simplify check for freeing cn_resp
Date: Sun, 16 Jan 2022 15:47:14 +0000	[thread overview]
Message-ID: <9362b77845cecef630cd2cf98e3daf557318941b.camel@hammerspace.com> (raw)
In-Reply-To: <20220116144301.399581-1-trix@redhat.com>

Hi Tom,

On Sun, 2022-01-16 at 06:43 -0800, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> nfs42_files_from_same_server() is called to check if freeing
> cn_resp is required.  Instead of calling a function, check
> the pointer.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  fs/nfs/nfs4file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
> index e79ae4cbc395e..677631ea4cfb3 100644
> --- a/fs/nfs/nfs4file.c
> +++ b/fs/nfs/nfs4file.c
> @@ -180,7 +180,7 @@ static ssize_t __nfs4_copy_file_range(struct file
> *file_in, loff_t pos_in,
>         ret = nfs42_proc_copy(file_in, pos_in, file_out, pos_out,
> count,
>                                 nss, cnrs, sync);
>  out:
> -       if (!nfs42_files_from_same_server(file_in, file_out))
> +       if (cn_resp)
>                 kfree(cn_resp);

The kernel convention in these circumstances is to just skip the NULL
pointer check, since kfree() does that anyway.

>         if (ret == -EAGAIN)
>                 goto retry;

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



  reply	other threads:[~2022-01-16 15:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-16 14:43 [PATCH] NFS: simplify check for freeing cn_resp trix
2022-01-16 15:47 ` Trond Myklebust [this message]
2022-01-16 16:26   ` Tom Rix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9362b77845cecef630cd2cf98e3daf557318941b.camel@hammerspace.com \
    --to=trondmy@hammerspace.com \
    --cc=anna.schumaker@netapp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox