Skip to contentSkip to conversation

vgem: fix error return in vgem_init()

PATCH Superseded Alexandr Sapozhnkiov 1 participant 1 message Sep 22, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vgem: fix error return in vgem_init()

From: Alexandr Sapozhnikov <[email protected]>

Return value of function dma_coerce_mask_and_coherent(), called at vgem_drv.c:143, is not checked,
but it is usually checked for this function

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 drivers/gpu/drm/vgem/vgem_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/vgem/vgem_drv.c +3 -1
index c5e3e5457737..dc132dd44b9e 100644
@@ -140,8 +140,10 @@ static int __init vgem_init(void)
 		goto out_unregister;
 	}
 
-	dma_coerce_mask_and_coherent(&pdev->dev,
+	ret = dma_coerce_mask_and_coherent(&pdev->dev,
 				     DMA_BIT_MASK(64));
+	if (ret)
+		goto out_devres;
 
 	vgem_device = devm_drm_dev_alloc(&pdev->dev, &vgem_driver,
 					 struct vgem_device, drm);
Signature · 1 line
2.43.0