[PATCH] DRM: drm_debugfs_create_files uses unitialized stack in error printk

Eric Paris eparis at redhat.com
Wed May 11 09:26:05 PDT 2011


drm_debugfs_create_files declares a char buf on the stack and prints it's
value in a error condition.  Before 28a62277 this character buf was filled
in but now it isn't.  Instead we can now get the name from the parent dentry
and don't need this at all.  Before this patch I would see a message like
below on every boot:

[drm:drm_debugfs_create_files] *ERROR* Cannot create /sys/kernel/debug/dri/I�5^B���/3

Signed-off-by: Eric Paris <eparis at redhat.com>
---

 drivers/gpu/drm/drm_debugfs.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 9d8c892..b9dc262 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -90,7 +90,6 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count,
 	struct drm_device *dev = minor->dev;
 	struct dentry *ent;
 	struct drm_info_node *tmp;
-	char name[64];
 	int i, ret;
 
 	for (i = 0; i < count; i++) {
@@ -109,7 +108,7 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count,
 					  root, tmp, &drm_debugfs_fops);
 		if (!ent) {
 			DRM_ERROR("Cannot create /sys/kernel/debug/dri/%s/%s\n",
-				  name, files[i].name);
+				  root->d_name.name, files[i].name);
 			kfree(tmp);
 			ret = -1;
 			goto fail;



More information about the dri-devel mailing list