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]
Date:	Fri, 24 Sep 2010 23:37:51 +0400
From:	Anton Vorontsov <cbouatmailru@...il.com>
To:	Daniel Drake <dsd@...top.org>
Cc:	dwmw2@...radead.org, linux-kernel@...r.kernel.org,
	richard@...top.org, dilinger@...ued.net
Subject: Re: [PATCH] olpc_battery: Fix endian neutral breakage for s16
 values

On Fri, Sep 24, 2010 at 08:31:33PM +0100, Daniel Drake wrote:
> From: Richard A. Smith <richard@...top.org>
> 
> When the driver was updated to be endian neutral (8e9c7716c)
> the signed part of the s16 values was lost.  This is because be16_to_cpu()
> returns a signed value.  This patch casts the values back to a s16 number
> prior to the the cast up to an int.
> 
> Signed-off-by: Richard A. Smith <richard@...top.org>
> Signed-off-by: Daniel Drake <dsd@...top.org>

Good catch.

[...]
> -		val->intval = (int)be16_to_cpu(ec_word) * 9760L / 32;
> +		val->intval = (int)((s16)be16_to_cpu(ec_word)) * 9760L / 32;

Do we really need "(int)" then?

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@...il.com
irc://irc.freenode.net/bd2
--
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