Skip to contentSkip to conversation

drm/i915: remove unnecessary null test

PATCH Superseded Sudip Mukherjee 2 participants 4 messages Jul 20, 2015 – Jul 21, 2015

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/i915: remove unnecessary null test

While creating the debugfs file we are setting the inode->i_private to dev. That same dev is passed to these functions as private of struct seq_file via single_open(). So at this point it can never be NULL.

---

v1 was drm/i915: fix possible null pointer dereference

 drivers/gpu/drm/i915/i915_debugfs.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -9
index bc817da..63cb886 100644
@@ -4103,9 +4103,6 @@ static int i915_displayport_test_active_show(struct seq_file *m, void *data)
 	struct list_head *connector_list = &dev->mode_config.connector_list;
 	struct intel_dp *intel_dp;
 
-	if (!dev)
-		return -ENODEV;
-
 	list_for_each_entry(connector, connector_list, head) {
 
 		if (connector->connector_type !=
@@ -4150,9 +4147,6 @@ static int i915_displayport_test_data_show(struct seq_file *m, void *data)
 	struct list_head *connector_list = &dev->mode_config.connector_list;
 	struct intel_dp *intel_dp;
 
-	if (!dev)
-		return -ENODEV;
-
 	list_for_each_entry(connector, connector_list, head) {
 
 		if (connector->connector_type !=
@@ -4192,9 +4186,6 @@ static int i915_displayport_test_type_show(struct seq_file *m, void *data)
 	struct list_head *connector_list = &dev->mode_config.connector_list;
 	struct intel_dp *intel_dp;
 
-	if (!dev)
-		return -ENODEV;
-
 	list_for_each_entry(connector, connector_list, head) {
 
 		if (connector->connector_type !=
Signature · 6 lines
1.8.1.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 8 lines · Sudip Mukherjee

While creating the debugfs file we are setting the inode->i_private to dev. That same dev is passed to these functions as private of struct seq_file via single_open(). So at this point it can never be NULL.

---

v1 was drm/i915: fix possible null pointer dereference

There's still one left in i915_displayport_test_active_write. Also please mention the commit that introduced these and Cc: the author. Also please
Cc: Chris since he's commented on v1 of this patch.

Thanks, Daniel

Quoted 45 lines
 drivers/gpu/drm/i915/i915_debugfs.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -9
index bc817da..63cb886 100644
@@ -4103,9 +4103,6 @@ static int i915_displayport_test_active_show(struct seq_file *m, void *data)
 	struct list_head *connector_list = &dev->mode_config.connector_list;
 	struct intel_dp *intel_dp;
 
-	if (!dev)
-		return -ENODEV;
-
 	list_for_each_entry(connector, connector_list, head) {
 
 		if (connector->connector_type !=
@@ -4150,9 +4147,6 @@ static int i915_displayport_test_data_show(struct seq_file *m, void *data)
 	struct list_head *connector_list = &dev->mode_config.connector_list;
 	struct intel_dp *intel_dp;
 
-	if (!dev)
-		return -ENODEV;
-
 	list_for_each_entry(connector, connector_list, head) {
 
 		if (connector->connector_type !=
@@ -4192,9 +4186,6 @@ static int i915_displayport_test_type_show(struct seq_file *m, void *data)
 	struct list_head *connector_list = &dev->mode_config.connector_list;
 	struct intel_dp *intel_dp;
 
-	if (!dev)
-		return -ENODEV;
-
 	list_for_each_entry(connector, connector_list, head) {
 
 		if (connector->connector_type !=
Signature · 6 lines
1.8.1.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 11 lines · Daniel Vetter
Quoted 8 lines · Sudip Mukherjee

While creating the debugfs file we are setting the inode->i_private to dev. That same dev is passed to these functions as private of struct seq_file via single_open(). So at this point it can never be NULL.

---

v1 was drm/i915: fix possible null pointer dereference

There's still one left in i915_displayport_test_active_write.

I left it out intentionally as it was not used via single_open(). Will include that and send v3.

Quoted 2 lines

Also please mention the commit that introduced these and Cc: the author. Also please Cc: Chris since he's commented on v1 of this patch.

sure, Chris was Cc: in v2 and will Cc: him in v3 also.

regards
sudip
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 6 lines · Sudip Mukherjee
Quoted 5 lines · Daniel Vetter
Quoted 4 lines · Sudip Mukherjee

While creating the debugfs file we are setting the inode->i_private to dev. That same dev is passed to these functions as private of struct seq_file via single_open(). So at this point it can never be NULL.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

---

v1 was drm/i915: fix possible null pointer dereference

There's still one left in i915_displayport_test_active_write.

I left it out intentionally as it was not used via single_open(). Will include that and send v3.

Well I didn't even read that far ;-) But ->write can only be called once you opened the file, which means it will be set up already correctly too. -Daniel

Quoted 10 lines
Quoted 2 lines

Also please mention the commit that introduced these and Cc: the author. Also please Cc: Chris since he's commented on v1 of this patch.

sure, Chris was Cc: in v2 and will Cc: him in v3 also.

regards
sudip
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx