All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm: Distinguish no name from ENOMEM in set_unique()
@ 2016-09-21 14:59 Tom Gundersen
  2016-09-21 14:59 ` [PATCH 2/2] drm: Don't swallow error codes in drm_dev_alloc() Tom Gundersen
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Tom Gundersen @ 2016-09-21 14:59 UTC (permalink / raw)
  To: dri-devel

If passing name == NULL to drm_drv_set_unique() we now get -ENOMEM
as kstrdup() returns NULL. Instead check for this explicitly and
return -EINVAL if no name is provided.

Signed-off-by: Tom Gundersen <teg@jklm.no>
---
 drivers/gpu/drm/drm_drv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index f2f6429..99e6751 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -338,6 +338,9 @@ void drm_minor_release(struct drm_minor *minor)
 
 static int drm_dev_set_unique(struct drm_device *dev, const char *name)
 {
+	if (!name)
+		return -EINVAL;
+
 	kfree(dev->unique);
 	dev->unique = kstrdup(name, GFP_KERNEL);
 
-- 
2.9.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2016-09-22 15:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-21 14:59 [PATCH 1/2] drm: Distinguish no name from ENOMEM in set_unique() Tom Gundersen
2016-09-21 14:59 ` [PATCH 2/2] drm: Don't swallow error codes in drm_dev_alloc() Tom Gundersen
2016-09-22  6:25   ` Daniel Vetter
2016-09-22  7:31   ` David Herrmann
2016-09-22  9:47   ` Eric Engestrom
2016-09-22 10:17     ` Tom Gundersen
2016-09-22 12:07   ` Sean Paul
2016-09-22  6:08 ` [PATCH 1/2] drm: Distinguish no name from ENOMEM in set_unique() Daniel Vetter
2016-09-22  6:28 ` Emil Velikov
2016-09-22 10:13   ` Tom Gundersen
2016-09-22 12:07 ` Sean Paul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.