From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Rodolfo C Villordo <rodolfovillordo@gmail.com>
Cc: devel@driverdev.osuosl.org, Richard Yeh <rcy@google.com>,
Todd Poynor <toddpoynor@google.com>,
Rob Springer <rspringer@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: gasket: replace symbolic permissions
Date: Fri, 19 Jun 2020 10:32:24 +0200 [thread overview]
Message-ID: <20200619083224.GA473790@kroah.com> (raw)
In-Reply-To: <20200619082714.GA7780@ip-172-31-24-31.ec2.internal>
On Fri, Jun 19, 2020 at 08:27:14AM +0000, Rodolfo C Villordo wrote:
> On Thu, Jun 18, 2020 at 09:47:50AM +0200, Greg Kroah-Hartman wrote:
> > On Mon, Jun 01, 2020 at 12:52:40AM +0000, Rodolfo C. Villordo wrote:
> > > WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> > > + .attr = __ATTR(_name, S_IRUGO, _show_function, NULL), \
> > > warning detected by checkpatch.pl
> > >
> > > Signed-off-by: Rodolfo C. Villordo <rodolfovillordo@gmail.com>
> > > ---
> > > drivers/staging/gasket/gasket_sysfs.h | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/gasket/gasket_sysfs.h b/drivers/staging/gasket/gasket_sysfs.h
> > > index ab5aa351d555..d5e167dfbe76 100644
> > > --- a/drivers/staging/gasket/gasket_sysfs.h
> > > +++ b/drivers/staging/gasket/gasket_sysfs.h
> > > @@ -71,7 +71,7 @@ struct gasket_sysfs_attribute {
> > >
> > > #define GASKET_SYSFS_RO(_name, _show_function, _attr_type) \
> > > { \
> > > - .attr = __ATTR(_name, S_IRUGO, _show_function, NULL), \
> > > + .attr = __ATTR(_name, 0444, _show_function, NULL), \
> >
> > What about using __ATTR_RO() instead?
> >
>
> I'm not sure if __ATTR_RO() is a good match here. The
> GASKET_SYSFS_RO() is invoked with different show functions across the
> code. These functions don't follow the name pattern attr_name_show
> used in __ATTR_RO(). Please correct me if I misunderstood anything.
>
> ### from include/linux/sysfs.h ###
> #define __ATTR_RO(_name) { \
> .attr = { .name = __stringify(_name), .mode = 0444 }, \
> .show = _name##_show, \
> }
> ###
>
> ### macro usage across the driver: ###
> $ grep GASKET_SYSFS_RO drivers/staging/gasket/*
> drivers/staging/gasket/apex_driver.c: GASKET_SYSFS_RO(node_0_page_table_entries, sysfs_show,
> drivers/staging/gasket/apex_driver.c: GASKET_SYSFS_RO(node_0_simple_page_table_entries, sysfs_show,
> drivers/staging/gasket/apex_driver.c: GASKET_SYSFS_RO(node_0_num_mapped_pages, sysfs_show,
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(bar_offsets, gasket_sysfs_data_show, ATTR_BAR_OFFSETS),
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(bar_sizes, gasket_sysfs_data_show, ATTR_BAR_SIZES),
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(driver_version, gasket_sysfs_data_show,
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(framework_version, gasket_sysfs_data_show,
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(device_type, gasket_sysfs_data_show, ATTR_DEVICE_TYPE),
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(revision, gasket_sysfs_data_show,
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(pci_address, gasket_sysfs_data_show, ATTR_PCI_ADDRESS),
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(status, gasket_sysfs_data_show, ATTR_STATUS),
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(is_device_owned, gasket_sysfs_data_show,
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(device_owner, gasket_sysfs_data_show,
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(write_open_count, gasket_sysfs_data_show,
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(reset_count, gasket_sysfs_data_show, ATTR_RESET_COUNT),
> drivers/staging/gasket/gasket_core.c: GASKET_SYSFS_RO(user_mem_ranges, gasket_sysfs_data_show,
> drivers/staging/gasket/gasket_interrupt.c: GASKET_SYSFS_RO(interrupt_counts, interrupt_sysfs_show,
> ###
Ugh, you are right, that's a mess. Your original patch is fine, can you
resend it and say in the changelog why it's not ok to use __ATTR_RO()?
thanks,
greg k-h
next prev parent reply other threads:[~2020-06-19 8:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-01 0:52 [PATCH] staging: gasket: replace symbolic permissions Rodolfo C. Villordo
2020-06-18 7:47 ` Greg Kroah-Hartman
2020-06-19 8:27 ` Rodolfo C Villordo
2020-06-19 8:32 ` Greg Kroah-Hartman [this message]
2020-06-22 7:13 ` Rodolfo C Villordo
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=20200619083224.GA473790@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rcy@google.com \
--cc=rodolfovillordo@gmail.com \
--cc=rspringer@google.com \
--cc=toddpoynor@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.