]> Git Repo - linux.git/commitdiff
iommufd: Fix error pointer checking
authorLu Baolu <[email protected]>
Fri, 12 Jul 2024 02:58:19 +0000 (10:58 +0800)
committerJason Gunthorpe <[email protected]>
Fri, 12 Jul 2024 12:51:25 +0000 (09:51 -0300)
Smatch static checker reported below warning:

    drivers/iommu/iommufd/fault.c:131 iommufd_device_get_attach_handle()
    warn: 'handle' is an error pointer or valid

Fix it by checking 'handle' with IS_ERR().

Fixes: b7d8833677ba ("iommufd: Fault-capable hwpt attach/detach/replace")
Link: https://lore.kernel.org/r/[email protected]
Reported-by: Dan Carpenter <[email protected]>
Closes: https://lore.kernel.org/linux-iommu/[email protected]/
Signed-off-by: Lu Baolu <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
drivers/iommu/iommufd/fault.c

index 9c142cefa2d2c0653224f920448e52867e342b15..a643d5c7c535f553a2175406ca4f65d38d152ccd 100644 (file)
@@ -128,7 +128,7 @@ iommufd_device_get_attach_handle(struct iommufd_device *idev)
        struct iommu_attach_handle *handle;
 
        handle = iommu_attach_handle_get(idev->igroup->group, IOMMU_NO_PASID, 0);
-       if (!handle)
+       if (IS_ERR(handle))
                return NULL;
 
        return to_iommufd_handle(handle);
This page took 0.058707 seconds and 4 git commands to generate.