[PATCH 2/8] drm: remove redundant drm_file->uid

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 3 18:57:00 UTC 2016


On Wed, Aug 03, 2016 at 08:04:26PM +0200, David Herrmann wrote:
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index 323c238..e9d66f5 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -199,7 +199,6 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
>  
>  	filp->private_data = priv;
>  	priv->filp = filp;
> -	priv->uid = current_euid();
>  	priv->pid = get_pid(task_pid(current));
>  	priv->minor = minor;
>  
> diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c
> index 9ae353f..247ba2b 100644
> --- a/drivers/gpu/drm/drm_info.c
> +++ b/drivers/gpu/drm/drm_info.c
> @@ -98,13 +99,14 @@ int drm_clients_info(struct seq_file *m, void *data)
>  
>  		rcu_read_lock(); /* locks pid_task()->comm */
>  		task = pid_task(priv->pid, PIDTYPE_PID);
> +		uid = priv->filp ? priv->filp->f_cred->euid : GLOBAL_ROOT_UID;

uid = task_euid(task);

>  		seq_printf(m, "%20s %5d %3d   %c    %c %5d %10u\n",
>  			   task ? task->comm : "<unknown>",
>  			   pid_vnr(priv->pid),
>  			   priv->minor->index,
>  			   drm_is_current_master(priv) ? 'y' : 'n',
>  			   priv->authenticated ? 'y' : 'n',
> -			   from_kuid_munged(seq_user_ns(m), priv->uid),
> +			   from_kuid_munged(seq_user_ns(m), uid),
			   from_kuid_munged(seq_user_ns(m), task_euid(task)),

Just fits.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the dri-devel mailing list