linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/i915: remove unnecessary null test
@ 2015-07-20 15:06 Sudip Mukherjee
  2015-07-20 15:33 ` [Intel-gfx] " Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2015-07-20 15:06 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, David Airlie
  Cc: linux-kernel, intel-gfx, dri-devel, Chris Wilson, 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.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

v1 was drm/i915: fix possible null pointer dereference

 drivers/gpu/drm/i915/i915_debugfs.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index bc817da..63cb886 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -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 !=
-- 
1.8.1.2


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

* Re: [Intel-gfx] [PATCH v2] drm/i915: remove unnecessary null test
  2015-07-20 15:06 [PATCH v2] drm/i915: remove unnecessary null test Sudip Mukherjee
@ 2015-07-20 15:33 ` Daniel Vetter
  2015-07-21  6:41   ` Sudip Mukherjee
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2015-07-20 15:33 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Daniel Vetter, Jani Nikula, David Airlie, intel-gfx, linux-kernel,
	dri-devel

On Mon, Jul 20, 2015 at 08:36:01PM +0530, Sudip Mukherjee wrote:
> 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.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> 
> 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

> 
>  drivers/gpu/drm/i915/i915_debugfs.c | 9 ---------
>  1 file changed, 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index bc817da..63cb886 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -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 !=
> -- 
> 1.8.1.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [Intel-gfx] [PATCH v2] drm/i915: remove unnecessary null test
  2015-07-20 15:33 ` [Intel-gfx] " Daniel Vetter
@ 2015-07-21  6:41   ` Sudip Mukherjee
  2015-07-21  7:37     ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2015-07-21  6:41 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, David Airlie, intel-gfx, linux-kernel,
	dri-devel

On Mon, Jul 20, 2015 at 05:33:50PM +0200, Daniel Vetter wrote:
> On Mon, Jul 20, 2015 at 08:36:01PM +0530, Sudip Mukherjee wrote:
> > 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.
> > 
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
> > 
> > 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.
>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

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

* Re: [Intel-gfx] [PATCH v2] drm/i915: remove unnecessary null test
  2015-07-21  6:41   ` Sudip Mukherjee
@ 2015-07-21  7:37     ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2015-07-21  7:37 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Daniel Vetter, Jani Nikula, David Airlie, intel-gfx, linux-kernel,
	dri-devel

On Tue, Jul 21, 2015 at 12:11:18PM +0530, Sudip Mukherjee wrote:
> On Mon, Jul 20, 2015 at 05:33:50PM +0200, Daniel Vetter wrote:
> > On Mon, Jul 20, 2015 at 08:36:01PM +0530, Sudip Mukherjee wrote:
> > > 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.
> > > 
> > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > > ---
> > > 
> > > 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

> >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
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

end of thread, other threads:[~2015-07-21  7:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-20 15:06 [PATCH v2] drm/i915: remove unnecessary null test Sudip Mukherjee
2015-07-20 15:33 ` [Intel-gfx] " Daniel Vetter
2015-07-21  6:41   ` Sudip Mukherjee
2015-07-21  7:37     ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).