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]
Message-ID: <64188480-09e3-4064-92e1-c1fa0a368cd2@roeck-us.net>
Date: Mon, 16 Dec 2024 15:53:48 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Murad Masimov <m.masimov@...ima.ru>
Cc: Eric Tremblay <etremblay@...tech-controls.com>,
	Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
	linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH 1/3] hwmon: (tmp513) Fix interpretation of values of
 Shunt Voltage and Limit Registers

On Mon, Dec 16, 2024 at 08:36:46PM +0300, Murad Masimov wrote:
> The values returned by the driver after processing the contents of the
> Shunt Voltage Register and the Shunt Limit Registers do not correspond to the
> TMP512/TMP513 specifications. A raw register value is converted to a signed
> integer value by a sign extension in accordance with the algorithm provided in
> the specification, but due to the off-by-one error in the sign bit index, the
> result is incorrect. Moreover, the PGA shift calculated with the
> tmp51x_get_pga_shift function is relevant only to the Shunt Voltage Register,
> but is also applied to the Shunt Limit Registers.
> 
> According to the TMP512 and TMP513 datasheets, the Shunt Voltage Register (04h)
> is 13 to 16 bit two's complement integer value, depending on the PGA setting.
> The Shunt Positive (0Ch) and Negative (0Dh) Limit Registers are 16-bit two's
> complement integer values. Below are some examples:
> 
> * Shunt Voltage Register
> If PGA = 8, and regval = 1000 0011 0000 0000, then the decimal value must
> be -32000, but the value calculated by the driver will be 33536.
> 
> * Shunt Limit Register
> If regval = 1000 0011 0000 0000, then the decimal value must be -32000, but
> the value calculated by the driver will be 768, if PGA = 1.
> 
> Fix sign bit index, and also correct misleading comment describing the
> tmp51x_get_pga_shift function.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 59dfa75e5d82 ("hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.")
> Signed-off-by: Murad Masimov <m.masimov@...ima.ru>

Applied, after fixing checkpatch complaints.

Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ