drm/i915: fix possible null pointer dereference
Subsystems (2)
PATCH 1/1 drm/i915: fix possible null pointer dereference
We were dereferencing dev first and then checking if it is NULL. Lets check for NULL first and then dereference.
--- drivers/gpu/drm/i915/i915_debugfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
@@ -4100,12 +4100,13 @@ static int i915_displayport_test_active_show(struct seq_file *m, void *data) {struct drm_device *dev = m->private;struct drm_connector *connector; -struct list_head *connector_list = &dev->mode_config.connector_list; +struct list_head *connector_list;struct intel_dp *intel_dp;if (!dev)return -ENODEV ; + connector_list = &dev->mode_config.connector_list;list_for_each_entry (connector, connector_list, head) { if (connector->connector_type !=
Signature · 1 line
1.8.1.2
Quoted 2 lines · Sudip Mukherjee
We were dereferencing dev first and then checking if it is NULL. Lets check for NULL first and then dereference.
The code is bonkers. Testing for a lack of a correctly constructed debugfs seq_file inside the debugfs seq_file callback is inane. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Chris Wilson
Quoted 2 lines · Sudip Mukherjee
We were dereferencing dev first and then checking if it is NULL. Lets check for NULL first and then dereference.
The code is bonkers. Testing for a lack of a correctly constructed debugfs
seq_fileinside the debugfsseq_filecallback is inane.
I missed seeing before sending this patch that there are some more places where this has been done.
Then are you suggesting to remove the test?
regards
sudip
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 10 lines · Sudip Mukherjee
Quoted 6 lines · Chris Wilson
Quoted 2 lines · Sudip Mukherjee
We were dereferencing dev first and then checking if it is NULL. Lets check for NULL first and then dereference.
The code is bonkers. Testing for a lack of a correctly constructed debugfs
seq_fileinside the debugfsseq_filecallback is inane.I missed seeing before sending this patch that there are some more places where this has been done.
Then are you suggesting to remove the test?
It's all been added for the tp validation support. And yes it should be removed everywhere.
-Daniel
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