public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] vgem: fix error return in vgem_init()
@ 2025-10-02  9:18 Alexandr Sapozhnkiov
  2025-10-03 14:42 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandr Sapozhnkiov @ 2025-10-02  9:18 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, dri-devel, linux-kernel
  Cc: Alexandr Sapozhnikov, lvc-project

From: Alexandr Sapozhnikov <alsp705@gmail.com>

The dma_coerce_mask_and_coherent function may 
fail to apply a mask due to incorrectly passed parameters. 
However, since this function returns the -EIO error, 
this is an abnormal situation and the error should be logged.

Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Alexandr Sapozhnikov <alsp705@gmail.com>
---
 drivers/gpu/drm/vgem/vgem_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index c5e3e5457737..dc132dd44b9e 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -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_unregister;
 
 	vgem_device = devm_drm_dev_alloc(&pdev->dev, &vgem_driver,
 					 struct vgem_device, drm);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] vgem: fix error return in vgem_init()
  2025-10-02  9:18 [PATCH v2] vgem: fix error return in vgem_init() Alexandr Sapozhnkiov
@ 2025-10-03 14:42 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2025-10-03 14:42 UTC (permalink / raw)
  To: Alexandr Sapozhnikov, dri-devel, lvc-project
  Cc: LKML, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann

> The dma_coerce_mask_and_coherent function may 
> fail to apply a mask due to incorrectly passed parameters. 
…

* You may occasionally put more than 61 characters into text lines
  of such a change description.
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17#n658

* Would you like to choose another imperative wording?

* How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?


…
> ---
>  drivers/gpu/drm/vgem/vgem_drv.c | 4 +++-
…

Some contributors would appreciate patch version descriptions.
https://lore.kernel.org/all/?q=%22This+looks+like+a+new+version+of+a+previously+submitted+patch%22> +++ b/drivers/gpu/drm/vgem/vgem_drv.c
> @@ -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_unregister;
…

I suggest to keep the passed parameters in the same line for this function call.

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-03 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02  9:18 [PATCH v2] vgem: fix error return in vgem_init() Alexandr Sapozhnkiov
2025-10-03 14:42 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox