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>] [day] [month] [year] [list]
Message-Id: <20190511085614.29677-1-lkundrak@v3.sk>
Date:   Sat, 11 May 2019 10:56:14 +0200
From:   Lubomir Rintel <lkundrak@...sk>
To:     Sebastian Reichel <sre@...nel.org>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Lubomir Rintel <lkundrak@...sk>,
        kbuild test robot <lkp@...el.com>
Subject: [PATCH] power: supply: olpc_battery: force the le/be casts

The endianness of data returned from the EC depends on the particular EC
version determined at run time. Cast from little/big endian explicitey
in the routine that flips endianness to the native one to make sparse
happy.

Signed-off-by: Lubomir Rintel <lkundrak@...sk>
Reported-by: kbuild test robot <lkp@...el.com>
Fixes: 76311b9a3295 ("power: supply: olpc_battery: Add OLPC XO 1.75 support")
---
 drivers/power/supply/olpc_battery.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c
index 4ccd242fcf72..066ec9a11153 100644
--- a/drivers/power/supply/olpc_battery.c
+++ b/drivers/power/supply/olpc_battery.c
@@ -326,9 +326,9 @@ static int olpc_bat_get_voltage_max_design(union power_supply_propval *val)
 static u16 ecword_to_cpu(struct olpc_battery_data *data, u16 ec_word)
 {
 	if (data->little_endian)
-		return le16_to_cpu(ec_word);
+		return le16_to_cpu((__force __le16)ec_word);
 	else
-		return be16_to_cpu(ec_word);
+		return be16_to_cpu((__force __be16)ec_word);
 }
 
 /*********************************************************************
@@ -340,7 +340,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
 {
 	struct olpc_battery_data *data = power_supply_get_drvdata(psy);
 	int ret = 0;
-	__be16 ec_word;
+	u16 ec_word;
 	uint8_t ec_byte;
 	__be64 ser_buf;
 
-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ