lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 09 Jan 2023 11:22:37 +0200
From:   Jani Nikula <jani.nikula@...ux.intel.com>
To:     Maíra Canal <mcanal@...lia.com>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Maxime Ripard <mripard@...nel.org>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>
Cc:     Melissa Wen <mwen@...lia.com>,
        André Almeida <andrealmeid@...lia.com>,
        linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        Maíra Canal <mcanal@...lia.com>
Subject: Re: [PATCH 1/2] drm/debugfs: use octal permissions instead of
 symbolic permissions

On Thu, 05 Jan 2023, Maíra Canal <mcanal@...lia.com> wrote:
> Currently, debugfs functions are using symbolic macros as permission
> bits, but checkpatch reinforces permission bits in the octal form, as
> they are more readable and easier to understand [1].
>
> Therefore, use octal permission bits in all debugfs functions.
>
> [1] https://docs.kernel.org/dev-tools/checkpatch.html#permissions
>
> Suggested-by: Jani Nikula <jani.nikula@...ux.intel.com>
> Signed-off-by: Maíra Canal <mcanal@...lia.com>

The commit message should also mention S_IFREG is redundant. Can be
fixed while applying.

Reviewed-by: Jani Nikula <jani.nikula@...el.com>

> ---
>  drivers/gpu/drm/drm_debugfs.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index 5ea237839439..4f643a490dc3 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -207,7 +207,7 @@ void drm_debugfs_create_files(const struct drm_info_list *files, int count,
>  
>  		tmp->minor = minor;
>  		tmp->dent = debugfs_create_file(files[i].name,
> -						S_IFREG | S_IRUGO, root, tmp,
> +						0444, root, tmp,
>  						&drm_debugfs_fops);
>  		tmp->info_ent = &files[i];
>  
> @@ -246,7 +246,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
>  		dev->driver->debugfs_init(minor);
>  
>  	list_for_each_entry_safe(entry, tmp, &dev->debugfs_list, list) {
> -		debugfs_create_file(entry->file.name, S_IFREG | S_IRUGO,
> +		debugfs_create_file(entry->file.name, 0444,
>  				    minor->debugfs_root, entry, &drm_debugfs_entry_fops);
>  		list_del(&entry->list);
>  	}
> @@ -263,7 +263,7 @@ void drm_debugfs_late_register(struct drm_device *dev)
>  		return;
>  
>  	list_for_each_entry_safe(entry, tmp, &dev->debugfs_list, list) {
> -		debugfs_create_file(entry->file.name, S_IFREG | S_IRUGO,
> +		debugfs_create_file(entry->file.name, 0444,
>  				    minor->debugfs_root, entry, &drm_debugfs_entry_fops);
>  		list_del(&entry->list);
>  	}
> @@ -508,15 +508,15 @@ void drm_debugfs_connector_add(struct drm_connector *connector)
>  	connector->debugfs_entry = root;
>  
>  	/* force */
> -	debugfs_create_file("force", S_IRUGO | S_IWUSR, root, connector,
> +	debugfs_create_file("force", 0644, root, connector,
>  			    &drm_connector_fops);
>  
>  	/* edid */
> -	debugfs_create_file("edid_override", S_IRUGO | S_IWUSR, root, connector,
> +	debugfs_create_file("edid_override", 0644, root, connector,
>  			    &drm_edid_fops);
>  
>  	/* vrr range */
> -	debugfs_create_file("vrr_range", S_IRUGO, root, connector,
> +	debugfs_create_file("vrr_range", 0444, root, connector,
>  			    &vrr_range_fops);
>  
>  	/* max bpc */

-- 
Jani Nikula, Intel Open Source Graphics Center

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ