Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp786609rwr; Fri, 5 May 2023 05:10:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Vmr3MXO1FUj5u2kVIGTTNVvMntWQa8rz6kEyxJEBEjRBMdUgcDxRLSvkNBtdumVuKnAgD X-Received: by 2002:a05:6a20:7295:b0:f2:ae03:4020 with SMTP id o21-20020a056a20729500b000f2ae034020mr1441505pzk.54.1683288643595; Fri, 05 May 2023 05:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683288643; cv=none; d=google.com; s=arc-20160816; b=aw0v+0uNbcQyv16CnSK54B5sjPF09yMNEGCwEx0xg1soLquF947kPjDiS7oVDJCeqO xVILhbB9cmF4vU2V5+3m7EGTJtk/NLytMF/mtBGN46upbWxeln1U291PHAyWD8c4Ch/Z ixLFKomzZi+tV4g3RJEygBr+7UdAFpu+OIrvGbdbJ10aSJydMSn0f3d2DDJMs0LTQbkr izAiT1U9myY3l0b8wNuSUPxj5X+et0DmABwljBg1oxTPzQxqSHoV7+KknTNpAXKeHv9r UZfLXdiB5VgdseL7V2gGNWVCNv6h9R14lC/px5GbWzBDNzFjFCxv0KMkeUdd2GKYhc1M iG6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0MC6iN0jyJ3sebi4322AXijEPMpLwnqb+pxmCX7Z+38=; b=dU2R4m/2aYayzYRTqPaov9eR1QjdjR3BMBe1XYM2zw4Q5Ps3oEHoMzyouEHSgeQ+WI qYKkaemxDclgcoZxH6wSUTSfFOrvTMcMuQhwJrCT/TiSpT54mZ14K+1fTSH8P+yCkN+Q 0ng+ho5zBN4n9VwzawKLJxPGPGu+Q99te9kUuoAmQW0il2AmvakxXqopmyig1TBIWhL7 yuniODi5dmME0mWiR7oKXZS/sanouRudvcM+QnPmSW1XK7IsXIQqTtJ8haKElys9+0V+ QGsfKLGPy/3DzKSjnfs5uFwLjQTVn7P7B3yAKopctUF2RFMPHdijDTjECTaAwJKRJXJj OtSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=c6t9ycwF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a27-20020a63705b000000b00518b499da59si1785173pgn.901.2023.05.05.05.10.29; Fri, 05 May 2023 05:10:43 -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=@ziepe.ca header.s=google header.b=c6t9ycwF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231945AbjEEL4T (ORCPT + 99 others); Fri, 5 May 2023 07:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231934AbjEEL4R (ORCPT ); Fri, 5 May 2023 07:56:17 -0400 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 529321A62F for ; Fri, 5 May 2023 04:56:14 -0700 (PDT) Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-74dfa88c65aso131918585a.3 for ; Fri, 05 May 2023 04:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1683287773; x=1685879773; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=0MC6iN0jyJ3sebi4322AXijEPMpLwnqb+pxmCX7Z+38=; b=c6t9ycwFWpO4ffaF1cs62dqA8Ud7QA8ArgT1GP6X2fYREIsCOD+Y/NvCkbZGiVZ/fy wjuwFBUk0aijciVJUBjLXHqOdsUielVPogpIH/MMIGE5drbOApx3mENdMjTMEH8DYsqD y1bhOdBzEFpHBlqfnl4p2zcdnPb8L8zvphqnwkqYaehNcbvwfOckObjnUDBCBUYrRnI+ ZFaP2JIPqBV7KciuKcaqLzisOUn2YemnVEJfKDQXU2eoUmr+USo1JjPS+muL6ZZUFWQ2 Qs+IET/XRJ7VBAcMCfND9MrqEmdLw4W3LQrZ7DCFGMYjVzFjwcbzLVOqelTU9t+WSdy+ qsgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683287773; x=1685879773; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0MC6iN0jyJ3sebi4322AXijEPMpLwnqb+pxmCX7Z+38=; b=NQvDMWYXL7I9A0j6mqQs0PuP8tZSk/qf/CeamMaf1pNcU1VAOa/GFjzw1mFVs8djXx BN+8W+VV8uPFnvEG7nYQqAK0Az35fDFBD0jDkVrIdc+zC5RDC4Vdyy8OzEO9+UHSjuOG 8FUJpa4guQrFFseVF4cYaUb9frTisRsiGEye3nyCShHyxVR+ojbrBMESKhjLGFExlVPf BkDtHiQ4WNBvuStJEyhegBJmdXlGJEj2UsnGD5lalF3qDeaMzcJ9Cz5Ocx9dihi2KrlX AFCvcK+W/TzRbfxK3ZtodIjA3037fvOLmWsnSIeL+7T6s1sgT83zozByal5cwOesiQ7f xUfQ== X-Gm-Message-State: AC+VfDwV6uo2ImhoTcSB8bQOIJJw59aqScnsWdqH2hYHK76OoOIITWqI GdQcwI7Fx2bwGNeUtZIZaca8Ag== X-Received: by 2002:ad4:5cc1:0:b0:5e9:2d8c:9a21 with SMTP id iu1-20020ad45cc1000000b005e92d8c9a21mr1914254qvb.32.1683287773386; Fri, 05 May 2023 04:56:13 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-25-194.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.25.194]) by smtp.gmail.com with ESMTPSA id y18-20020a0cf152000000b0061d5a59c36esm512183qvl.65.2023.05.05.04.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 04:56:12 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1puu2m-007s8W-Az; Fri, 05 May 2023 08:56:12 -0300 Date: Fri, 5 May 2023 08:56:12 -0300 From: Jason Gunthorpe 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() Message-ID: References: <202305051133576690069@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202305051133576690069@zte.com.cn> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Fri, May 05, 2023 at 11:33:57AM +0800, ye.xingchen@zte.com.cn wrote: > From: Ye Xingchen > > convert the fget()/fput() uses to fdget()/fdput(). > > Signed-off-by: Ye Xingchen > --- > 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