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] [day] [month] [year] [list]
Date:   Sun, 14 Feb 2021 14:21:01 +0000
From:   Arthur Simchaev <Arthur.Simchaev@....com>
To:     Greg KH <gregkh@...uxfoundation.org>,
        Bart Van Assche <bvanassche@....org>
CC:     "James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "alim.akhtar@...sung.com" <alim.akhtar@...sung.com>,
        Bean Huo <beanhuo@...ron.com>
Subject: RE: [PATCH] scsi: ufs: sysfs: add is_ascii_output entry

Done.

Regards
Arthur

> -----Original Message-----
> From: Greg KH <gregkh@...uxfoundation.org>
> Sent: Sunday, February 14, 2021 11:54 AM
> To: Bart Van Assche <bvanassche@....org>
> Cc: Arthur Simchaev <Arthur.Simchaev@....com>; James E . J . Bottomley
> <jejb@...ux.vnet.ibm.com>; Martin K . Petersen
> <martin.petersen@...cle.com>; linux-scsi@...r.kernel.org; linux-
> kernel@...r.kernel.org; alim.akhtar@...sung.com; Bean Huo
> <beanhuo@...ron.com>; Arthur Simchaev <Arthur.Simchaev@....com>
> Subject: Re: [PATCH] scsi: ufs: sysfs: add is_ascii_output entry
> 
> CAUTION: This email originated from outside of Western Digital. Do not click
> on links or open attachments unless you recognize the sender and know that
> the content is safe.
> 
> 
> On Wed, Feb 10, 2021 at 07:35:25PM -0800, Bart Van Assche wrote:
> > On 2/10/21 2:53 AM, Arthur Simchaev wrote:
> > > +static bool is_ascii_output = true;
> >
> > [ ... ]
> >
> > >  static const char *ufschd_uic_link_state_to_string(
> > >                     enum uic_link_state state)
> > >  {
> > > @@ -693,7 +695,15 @@ static ssize_t _name##_show(struct device *dev,
> \
> > >                                   SD_ASCII_STD);                    \
> > >     if (ret < 0)                                                    \
> > >             goto out;                                               \
> > > -   ret = sysfs_emit(buf, "%s\n", desc_buf);                        \
> > > +   if (is_ascii_output) {                                          \
> > > +           ret = sysfs_emit(buf, "%s\n", desc_buf);                \
> > > +   } else {                                                        \
> > > +           int i;                                                  \
> > > +                                                                   \
> > > +           for (i = 0; i < desc_buf[0]; i++)                       \
> > > +                   hex_byte_pack(buf + i * 2, desc_buf[i]);        \
> > > +           ret = sysfs_emit(buf, "%s\n", buf);                     \
> > > +   }                                                               \
> > >  out:                                                                       \
> > >     pm_runtime_put_sync(hba->dev);                                  \
> > >     kfree(desc_buf);                                                \
> >
> > Please do not introduce a mode variable but instead introduce a new
> > attribute such that there is one attribute for the unicode output and
> > one attribute for the ASCII output. Mode variables are troublesome when
> > e.g. two scripts try to set the mode attribute concurrently.
> 
> Agreed, just make a new sysfs file, please never change the output of an
> existing sysfs file, that way will guarantee confusion in userspace.
> 
> thanks,
> 
> greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ