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]
Message-ID: <20091204080813.GB1540@ucw.cz>
Date:	Fri, 4 Dec 2009 09:08:13 +0100
From:	Pavel Machek <pavel@....cz>
To:	Wu Zhangjin <wuzhangjin@...il.com>
Cc:	Ralf Baechle <ralf@...ux-mips.org>, akpm@...ux-foundation.org,
	linux-mips@...ux-mips.org, linux-kernel@...r.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	"Rafael J. Wysocki" <rjw@...k.pl>, zhangfx@...ote.com,
	linux-laptop@...r.kernel.org
Subject: Re: [PATCH v7 5/8] Loongson: YeeLoong: add hardware monitoring
	driver

Hi!

> +static int get_cpu_temp(void)
> +{
> +	int value;
> +
> +	value = ec_read(REG_TEMPERATURE_VALUE);
> +
> +	if (value & (1 << 7))
> +		value = (value & 0x7f) - 128;
> +	else
> +		value = value & 0xff;

wtf?

Maybe value should be 's8'?

> +static int get_battery_current(void)
> +{
> +	int value;
> +
> +	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
> +		(ec_read(REG_BAT_CURRENT_LOW));
> +
> +	if (value & 0x8000)
> +		value = 0xffff - value;

Another version of  pair-complement conversion; this one is broken --
off by 1.

> +static int parse_arg(const char *buf, unsigned long count, int *val)
> +{
> +	if (!count)
> +		return 0;
> +	if (sscanf(buf, "%i", val) != 1)
> +		return -EINVAL;
> +	return count;
> +}

We have strict_strtoul for a reason...

								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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