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]
Message-ID: <2023061307-oversized-wife-1f69@gregkh>
Date:   Tue, 13 Jun 2023 11:06:35 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Roy Luo <royluo@...gle.com>
Cc:     raychi@...gle.com, badhri@...gle.com,
        Alan Stern <stern@...land.harvard.edu>,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        Michael Grzeschik <m.grzeschik@...gutronix.de>,
        Bastien Nocera <hadess@...ess.net>,
        Mathias Nyman <mathias.nyman@...ux.intel.com>,
        Matthias Kaehlcke <mka@...omium.org>,
        Flavio Suligoi <f.suligoi@...m.it>,
        Douglas Anderson <dianders@...omium.org>,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
        kernel test robot <oliver.sang@...el.com>
Subject: Re: [PATCH v3] usb: core: add sysfs entry for usb device state

On Wed, Jun 07, 2023 at 06:58:08PM -0700, Roy Luo wrote:
> > > @@ -160,6 +160,16 @@ static ssize_t connect_type_show(struct device *dev,
> > >  }
> > >  static DEVICE_ATTR_RO(connect_type);
> > >
> > > +static ssize_t state_show(struct device *dev,
> > > +                       struct device_attribute *attr, char *buf)
> > > +{
> > > +     struct usb_port *port_dev = to_usb_port(dev);
> > > +     enum usb_device_state state = READ_ONCE(port_dev->state);
> > > +
> > > +     return sprintf(buf, "%s\n", usb_state_string(state));
> >
> > I thought checkpatch would warn you that you should be using
> > sysfs_emit() here, wonder why it didn't.
> >
> > thanks,
> >
> > greg k-h
> 
> I was using sprintf() instead of sysfs_emit() because I randomly referred
> to one of the nearby attributes. Looks like there are still many attributes in
> port.c that uses sprintf(), any reason why we didn't replace them?
> If not, I'm happy to do a clean-up so that others don't make the same mistake
> as I did :D

Doing whole-scale replacements across the kernel for stuff like this
isn't needed, just for new stuff, using the new apis is a good idea.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ