public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: ye.xingchen@zte.com.cn
Cc: leon@kernel.org, jiangjian@cdjrlc.com,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/core: Use fdget() and fdput()
Date: Fri, 5 May 2023 08:56:12 -0300	[thread overview]
Message-ID: <ZFTu3IX0sNItM80T@ziepe.ca> (raw)
In-Reply-To: <202305051133576690069@zte.com.cn>

On Fri, May 05, 2023 at 11:33:57AM +0800, ye.xingchen@zte.com.cn wrote:
> From: Ye Xingchen <ye.xingchen@zte.com.cn>
> 
> convert the fget()/fput() uses to fdget()/fdput().
> 
> Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
> ---
>  drivers/infiniband/core/rdma_core.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c
> index 29b1ab1d5f93..c35df0b27e86 100644
> --- a/drivers/infiniband/core/rdma_core.c
> +++ b/drivers/infiniband/core/rdma_core.c
> @@ -335,7 +335,7 @@ lookup_get_fd_uobject(const struct uverbs_api_object *obj,
>  		      enum rdma_lookup_mode mode)
>  {
>  	const struct uverbs_obj_fd_type *fd_type;
> -	struct file *f;
> +	struct fd f = fdget(fdno);
>  	struct ib_uobject *uobject;
>  	int fdno = id;
> 
> @@ -350,18 +350,17 @@ lookup_get_fd_uobject(const struct uverbs_api_object *obj,
>  	fd_type =
>  		container_of(obj->type_attrs, struct uverbs_obj_fd_type, type);
> 
> -	f = fget(fdno);
> -	if (!f)
> +	if (!f.file)
>  		return ERR_PTR(-EBADF);

This also has incorrect pairing with fdput

Jason

  reply	other threads:[~2023-05-05 11:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05  3:33 [PATCH] RDMA/core: Use fdget() and fdput() ye.xingchen
2023-05-05 11:56 ` Jason Gunthorpe [this message]
2023-05-05 16:32 ` Leon Romanovsky
2023-05-11  5:42 ` Al Viro

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=ZFTu3IX0sNItM80T@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=jiangjian@cdjrlc.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=ye.xingchen@zte.com.cn \
    /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