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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 3 May 2019 18:13:11 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [GIT PULL 20/22] intel_th: msu: Add a sysfs attribute showing
 possible modes

On Fri, May 03, 2019 at 11:44:53AM +0300, Alexander Shishkin wrote:
> With the addition of dynamically loadable buffer drivers, there needs
> to be a way of knowing the currently available ones without having to
> scan the list of loaded modules or trial and error.
> 
> Add a sysfs file that lists all the currently available "modes", listing
> both the MSC hardware operating modes and loaded buffer drivers.

sysfs files are to be only "one value per file".  This violates that
rule by a lot.

> +static ssize_t
> +modes_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct msu_buffer *mbuf;
> +	ssize_t ret = 0;
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(msc_mode); i++)
> +		ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s\n",
> +				 msc_mode[i]);

If you ever have to have a loop in a sysfs show function, you know you
are in trouble.  And here you have two of them.  Please do not do this.

thanks,

greg k-h

Powered by blists - more mailing lists