From nobody Wed Dec 17 14:23:36 2025 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 5FC2DEE49A0 for ; Sat, 19 Aug 2023 02:41:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244235AbjHSClK (ORCPT ); Fri, 18 Aug 2023 22:41:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244190AbjHSCkk (ORCPT ); Fri, 18 Aug 2023 22:40:40 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D06EE3AB2; Fri, 18 Aug 2023 19:40:38 -0700 (PDT) Received: from dggpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RSNH45yJrz1L972; Sat, 19 Aug 2023 10:39:12 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 19 Aug 2023 10:40:36 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 19 Aug 2023 10:40:35 +0800 From: Yang Yingliang To: , CC: , , , , , , , , Subject: [PATCH -next] vfio/pds: fix return value in pds_vfio_get_lm_file() Date: Sat, 19 Aug 2023 10:37:16 +0800 Message-ID: <20230819023716.3469037-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" anon_inode_getfile() never returns NULL pointer, it will return ERR_PTR() when it fails, so replace the check with IS_ERR(). Fixes: bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support") Signed-off-by: Yang Yingliang Reviewed-by: Brett Creeley --- drivers/vfio/pci/pds/lm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/pci/pds/lm.c b/drivers/vfio/pci/pds/lm.c index aec75574cab3..79fe2e66bb49 100644 --- a/drivers/vfio/pci/pds/lm.c +++ b/drivers/vfio/pci/pds/lm.c @@ -31,7 +31,7 @@ pds_vfio_get_lm_file(const struct file_operations *fops, = int flags, u64 size) /* Create file */ lm_file->filep =3D anon_inode_getfile("pds_vfio_lm", fops, lm_file, flags); - if (!lm_file->filep) + if (IS_ERR(lm_file->filep)) goto out_free_file; =20 stream_open(lm_file->filep->f_inode, lm_file->filep); --=20 2.25.1