From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8AB0C77B7D for ; Fri, 5 May 2023 06:12:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230172AbjEEGMu (ORCPT ); Fri, 5 May 2023 02:12:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjEEGMs (ORCPT ); Fri, 5 May 2023 02:12:48 -0400 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F70E1490F for ; Thu, 4 May 2023 23:12:46 -0700 (PDT) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4QCL2N02z5z5B14q; Fri, 5 May 2023 14:12:44 +0800 (CST) Received: from xaxapp02.zte.com.cn ([10.88.97.241]) by mse-fl1.zte.com.cn with SMTP id 3456Cbab063060; Fri, 5 May 2023 14:12:37 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp02[null]) by mapi (Zmail) with MAPI id mid31; Fri, 5 May 2023 14:12:39 +0800 (CST) Date: Fri, 5 May 2023 14:12:39 +0800 (CST) X-Zmail-TransId: 2afa64549e57ffffffff917-7d156 X-Mailer: Zmail v1.0 Message-ID: <202305051412396252364@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , Subject: =?UTF-8?B?W1BBVENIXSBpb21tdWZkL3NlbGZ0ZXN0OiBVc2UgZmRnZXQoKSBhbmQgZmRwdXQoKQ==?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 3456Cbab063060 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 64549E5C.000/4QCL2N02z5z5B14q Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ye Xingchen convert the fget()/fput() uses to fdget()/fdput(). Signed-off-by: Ye Xingchen --- drivers/iommu/iommufd/selftest.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c index 74c2076105d4..d3512fa673a5 100644 --- a/drivers/iommu/iommufd/selftest.c +++ b/drivers/iommu/iommufd/selftest.c @@ -583,17 +583,16 @@ static const struct file_operations iommfd_test_staccess_fops; static struct selftest_access *iommufd_access_get(int fd) { - struct file *file; + struct fd f = fdget(fd); - file = fget(fd); - if (!file) + if (!f.file) return ERR_PTR(-EBADFD); - if (file->f_op != &iommfd_test_staccess_fops) { - fput(file); + if (f.file->f_op != &iommfd_test_staccess_fops) { + fdput(f); return ERR_PTR(-EBADFD); } - return file->private_data; + return f.file->private_data; } static void iommufd_test_access_unmap(void *data, unsigned long iova, -- 2.25.1