public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	David Airlie <airlied@linux.ie>,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 1/2] drm/i915: remove unnecessary null test
Date: Tue, 21 Jul 2015 15:51:40 +0200	[thread overview]
Message-ID: <20150721135140.GM16722@phenom.ffwll.local> (raw)
In-Reply-To: <1437480406-19285-1-git-send-email-sudipm.mukherjee@gmail.com>

On Tue, Jul 21, 2015 at 05:36:45PM +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(). Moreover single_open is setting
> file->private_data->private to dev.
> So at this point it can never be NULL.
> This check was added by commit eb3394faeb97 ("drm/i915: Add debugfs test
> control files for Displayport compliance testing")
> 

Still missing

Cc: Chris Wilson ...
Cc: Todd Previte ...

here to make sure reviewers/original authors are in the loop. Anyway this
is a simple enough patch, so I just pulled them both in.

Thanks, Daniel

> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> 
> v3: removed the check in i915_displayport_test_active_write also
> v2: removed null check
> v1 was drm/i915: fix possible null pointer dereference
> 
>  drivers/gpu/drm/i915/i915_debugfs.c | 21 +--------------------
>  1 file changed, 1 insertion(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index bc817da..ffce62e 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -4028,24 +4028,14 @@ static ssize_t i915_displayport_test_active_write(struct file *file,
>  {
>  	char *input_buffer;
>  	int status = 0;
> -	struct seq_file *m;
>  	struct drm_device *dev;
>  	struct drm_connector *connector;
>  	struct list_head *connector_list;
>  	struct intel_dp *intel_dp;
>  	int val = 0;
>  
> -	m = file->private_data;
> -	if (!m) {
> -		status = -ENODEV;
> -		return status;
> -	}
> -	dev = m->private;
> +	dev = ((struct seq_file *)file->private_data)->private;
>  
> -	if (!dev) {
> -		status = -ENODEV;
> -		return status;
> -	}
>  	connector_list = &dev->mode_config.connector_list;
>  
>  	if (len == 0)
> @@ -4103,9 +4093,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 +4137,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 +4176,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
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

  parent reply	other threads:[~2015-07-21 13:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21 12:06 [PATCH v3 1/2] drm/i915: remove unnecessary null test Sudip Mukherjee
2015-07-21 12:06 ` [PATCH v3 2/2] drm/i915: remove redundant if check Sudip Mukherjee
2015-07-21 13:51 ` Daniel Vetter [this message]
2015-07-21 13:56   ` [PATCH v3 1/2] drm/i915: remove unnecessary null test Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150721135140.GM16722@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox