Skip to contentSkip to conversation

drm: fix messages about failed procfs/debugfs file registration

PATCH In review Marcin Slusarz 3 participants 5 messages Oct 9, 2011 – Oct 10, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: fix messages about failed procfs/debugfs file registration

It printed garbage from stack:
[drm:drm_debugfs_create_files] *ERROR* Cannot create /sys/kernel/debug/dri/!.wy/2

---
 drivers/gpu/drm/drm_debugfs.c |    3 +--
 drivers/gpu/drm/drm_proc.c    |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_debugfs.c +1 -2
index 9d8c892..b9dc262 100644
@@ -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;
drivers/gpu/drm/drm_proc.c +1 -2
index 9e5b07e..0f3c4e3 100644
@@ -95,7 +95,6 @@ int drm_proc_create_files(struct drm_info_list *files, int count,
 	struct drm_device *dev = minor->dev;
 	struct proc_dir_entry *ent;
 	struct drm_info_node *tmp;
-	char name[64];
 	int i, ret;
 
 	for (i = 0; i < count; i++) {
@@ -118,7 +117,7 @@ int drm_proc_create_files(struct drm_info_list *files, int count,
 				       &drm_proc_fops, tmp);
 		if (!ent) {
 			DRM_ERROR("Cannot create /proc/dri/%s/%s\n",
-				  name, files[i].name);
+				  root->name, files[i].name);
 			list_del(&tmp->list);
 			kfree(tmp);
 			ret = -1;
Signature · 1 line
1.7.6.1
#2 lore raw

----- Original Message -----

Quoted 6 lines

From: "Dave Airlie" <[email protected]>
To: "Marcin Slusarz" <[email protected]>
Cc: "Daniel Yek" <[email protected]>, [email protected]
Sent: Monday, 10 October, 2011 9:00:19 AM
Subject: Re: [PATCH] drm: fix messages about failed procfs/debugfs file registration

Quoted 9 lines
Quoted 6 lines · Marcin Slusarz

It printed garbage from stack:
[drm:drm_debugfs_create_files] *ERROR* Cannot create /sys/kernel/debug/dri/!.wy/2

I have 4d5cb60d3f6c396899a515e0e667d0f855ed66cc

Typoed some vim onto the original mail.

Dave.

#3 lore raw

PATCH 1/2 drm: fix error message about failed procfs file registration

It printed garbage.

---
 drivers/gpu/drm/drm_proc.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_proc.c +1 -2
index 9e5b07e..0f3c4e3 100644
@@ -95,7 +95,6 @@ int drm_proc_create_files(struct drm_info_list *files, int count,
 	struct drm_device *dev = minor->dev;
 	struct proc_dir_entry *ent;
 	struct drm_info_node *tmp;
-	char name[64];
 	int i, ret;
 
 	for (i = 0; i < count; i++) {
@@ -118,7 +117,7 @@ int drm_proc_create_files(struct drm_info_list *files, int count,
 				       &drm_proc_fops, tmp);
 		if (!ent) {
 			DRM_ERROR("Cannot create /proc/dri/%s/%s\n",
-				  name, files[i].name);
+				  root->name, files[i].name);
 			list_del(&tmp->list);
 			kfree(tmp);
 			ret = -1;
Signature · 1 line
1.7.6.1
#4 lore raw

PATCH 2/2 drm: simplify error printing in drm_debugfs_create_files

In reply to David Airlie

There's no need to copy d_name.name.

---
 drivers/gpu/drm/drm_debugfs.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_debugfs.c +1 -4
index 9d2668a..b9dc262 100644
@@ -107,11 +107,8 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count,
 		ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
 					  root, tmp, &drm_debugfs_fops);
 		if (!ent) {
-			char name[64];
-			strncpy(name, root->d_name.name,
-						min(root->d_name.len, 64U));
 			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;
Signature · 1 line
1.7.6.1