[PATCH] staging: gasket: Use octal permissions instead of symbolic.

Greg KH gregkh at linuxfoundation.org
Wed Nov 7 12:27:17 UTC 2018


On Wed, Nov 07, 2018 at 05:41:29PM +0530, Rohit Sarkar wrote:
> On Tue, Nov 06, 2018 at 09:12:45PM +0100, Greg KH wrote:
> > On Tue, Nov 06, 2018 at 04:33:47PM +0530, Rohit Sarkar wrote:
> > > Replace S_IRUGO with 0444. Issue found by checkpatch.
> > > 
> > > Signed-off-by: Rohit Sarkar <rohitsarkar5398 at gmail.com>
> > > ---
> > >  drivers/staging/gasket/gasket_sysfs.h | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/staging/gasket/gasket_sysfs.h b/drivers/staging/gasket/gasket_sysfs.h
> > > index 151e8edd28ea..60590ea4b760 100644
> > > --- a/drivers/staging/gasket/gasket_sysfs.h
> > > +++ b/drivers/staging/gasket/gasket_sysfs.h
> > > @@ -40,7 +40,7 @@
> > >   */
> > >  #define GASKET_END_OF_ATTR_ARRAY                                               \
> > >  	{                                                                      \
> > > -		.attr = __ATTR(GASKET_ARRAY_END_TOKEN, S_IRUGO, NULL, NULL),   \
> > > +		.attr = __ATTR(GASKET_ARRAY_END_TOKEN, 0444, NULL, NULL),   \
> > >  		.data.attr_type = 0,                                           \
> > 
> > No, this horrid #define needs to just be removed entirely, it's not
> > really needed at all.
> > 
> > >  	}
> > >  
> > > @@ -75,7 +75,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),          \
> > 
> > __ATTR_RO() please.
> > 
> > Or just fix it up so this isn't needed at all, the sysfs usage in this
> > driver needs major work (i.e. almost deleted entirely...)
> > 
> > thanks,
> > 
> > greg k-h
> 
> Hey,
> I am relatively new to the community and I was searching for things
> to work on. I would love to help with this. Do you think this would be
> a good task for me to get started with as I cannot seem to guage the
> difficulty of this.

If you do not understand how "raw" sysfs files work, no, I would not
recommend this.  Also, this whole driver is hopefully going to be
deleted soon by using a UIO driver.

But, that deletion might take a while, so if you really are interested,
read up on how kobjects and sysfs attributes work and you might be able
to fix this up before the code gets deleted, it's up to you :)

thanks,

greg k-h


More information about the devel mailing list