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] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 25 Apr 2007 12:18:03 +0100
From:	"Simon Arlott" <simon@...e.lp0.eu>
To:	"Duncan Sands" <duncan.sands@...h.u-psud.fr>
Cc:	"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
	"Greg Kroah-Hartman" <gregkh@...e.de>,
	"Andrew Morton" <akpm@...ux-foundation.org>
Subject: Re: [PATCH] cxacru: Cleanup sysfs attribute code

On Wed, April 25, 2007 08:19, Duncan Sands wrote:
> Hi Simon,
>
>>  static ssize_t cxacru_sysfs_showattr_dB(s16 value, char *buf)
>>  {
>> -	if (unlikely(value < 0)) {
>> -		return snprintf(buf, PAGE_SIZE, "%d.%02u\n",
>> -						value / 100, -value % 100);
>> -	} else {
>> -		return snprintf(buf, PAGE_SIZE, "%d.%02u\n",
>> -						value / 100, value % 100);
>> -	}
>> +	return snprintf(buf, PAGE_SIZE, "%u.%02u\n",
>> +					value / 100, abs(value) % 100);
>
> shouldn't this be "%d.%02u\n"?

Yes, I'll send an updated patch this evening, unless Andrew adds the change himself by then.

>> +	static char *str[] = { "no", "yes" };
> ...
>> +	return snprintf(buf, PAGE_SIZE, "%s\n", str[value]);
>
> This could be
> 	static char *str[] = { "no\n", "yes\n" };
> ...
> 	return snprintf(buf, PAGE_SIZE, str[value]);
> I'm not saying that it's better, just a remark!

The \ns in the larger arrays were making them less readable.

-- 
Simon Arlott
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ