* [PATCH] drm/ingenic: fix error code in ingenic_drm_gem_create_object()
@ 2021-11-18 11:15 Dan Carpenter
2021-12-09 8:10 ` Thomas Zimmermann
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-11-18 11:15 UTC (permalink / raw)
To: Paul Cercueil
Cc: David Airlie, Daniel Vetter, Thomas Zimmermann, linux-mips,
dri-devel, kernel-janitors
The ->gem_create_object() function pointers are supposed to return NULL
on error. This function returns an error pointer but none of the
callers expect that so it will lead to an Oops. See drm_gem_vram_create()
for example of it checks for NULL but an error pointer would lead to a
crash.
Fixes: 4a791cb6d34f ("drm/ingenic: Add option to alloc cached GEM buffers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index a5df1c8d34cd..eb7266a0b037 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -757,7 +757,7 @@ ingenic_drm_gem_create_object(struct drm_device *drm, size_t size)
obj = kzalloc(sizeof(*obj), GFP_KERNEL);
if (!obj)
- return ERR_PTR(-ENOMEM);
+ return NULL;
obj->map_noncoherent = priv->soc_info->map_noncoherent;
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/ingenic: fix error code in ingenic_drm_gem_create_object()
2021-11-18 11:15 [PATCH] drm/ingenic: fix error code in ingenic_drm_gem_create_object() Dan Carpenter
@ 2021-12-09 8:10 ` Thomas Zimmermann
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zimmermann @ 2021-12-09 8:10 UTC (permalink / raw)
To: Dan Carpenter, Paul Cercueil
Cc: David Airlie, Daniel Vetter, linux-mips, dri-devel,
kernel-janitors
[-- Attachment #1.1: Type: text/plain, Size: 1475 bytes --]
FYI this issue was fixed by [1]. Please don't merge.
[1]
https://lore.kernel.org/dri-devel/20211130095255.26710-1-tzimmermann@suse.de/
Am 18.11.21 um 12:15 schrieb Dan Carpenter:
> The ->gem_create_object() function pointers are supposed to return NULL
> on error. This function returns an error pointer but none of the
> callers expect that so it will lead to an Oops. See drm_gem_vram_create()
> for example of it checks for NULL but an error pointer would lead to a
> crash.
>
> Fixes: 4a791cb6d34f ("drm/ingenic: Add option to alloc cached GEM buffers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index a5df1c8d34cd..eb7266a0b037 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -757,7 +757,7 @@ ingenic_drm_gem_create_object(struct drm_device *drm, size_t size)
>
> obj = kzalloc(sizeof(*obj), GFP_KERNEL);
> if (!obj)
> - return ERR_PTR(-ENOMEM);
> + return NULL;
>
> obj->map_noncoherent = priv->soc_info->map_noncoherent;
>
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-09 8:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-18 11:15 [PATCH] drm/ingenic: fix error code in ingenic_drm_gem_create_object() Dan Carpenter
2021-12-09 8:10 ` Thomas Zimmermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox