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: <8a88b1db0b9447ebaa37636a68e3b018@intel.com>
Date:   Tue, 28 Jul 2020 19:16:55 +0000
From:   "Winkler, Tomas" <tomas.winkler@...el.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC:     "Usyskin, Alexander" <alexander.usyskin@...el.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [char-misc-next V2] mei: add device kind to sysfs


> 
> On Tue, Jul 28, 2020 at 09:28:36PM +0300, Tomas Winkler wrote:
> > +/**
> > + * kind_show - display device kind
> > + *
> > + * @device: device pointer
> > + * @attr: attribute pointer
> > + * @buf: char out buffer
> > + *
> > + * Return: number of the bytes printed into buf or error
> 
> No need for kernel doc for static sysfs attributes, but ok...
> 
> > + */
> > +static ssize_t kind_show(struct device *device,
> > +			 struct device_attribute *attr, char *buf) {
> > +	struct mei_device *dev = dev_get_drvdata(device);
> > +	ssize_t ret = 0;
> 
> No need to initialize this.
Right, a leftover from an earlier version. 
> 
> > +
> > +	mutex_lock(&dev->device_lock);
> > +	if (dev->kind)
> > +		ret = sprintf(buf, "%s\n", dev->kind);
> > +	else
> > +		ret = sprintf(buf, "%s\n", "mei");
> > +	mutex_unlock(&dev->device_lock);
> 
> Why do you need a lock?  kind can not change, so what are you trying to
> protect from?
There might be firmware initiated reset but in this particular case you are right,  the lock is not needed.

Will resend. 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ