Skip to contentSkip to conversation

iommufd: Fix error pointer checking

PATCH Applied Lu Baolu 2 participants 2 messages Jul 12, 2024

Subsystems (2)
lore
Share & tools
lore

Lu Baolu

author
#0 lore raw

PATCH 1/1 iommufd: Fix error pointer checking

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")
---
 drivers/iommu/iommufd/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommufd/fault.c +1 -1
index e6bda84865f0..29f522819759 100644
@@ -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);
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · Lu Baolu

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().

Quoted 7 lines
Fixes b7d8833677ba ("iommufd: Fault-capable hwpt attach/detach/replace")
---
 drivers/iommu/iommufd/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied

Thanks,
Jason