summaryrefslogtreecommitdiff
path: root/scripts/patch-kernel
diff options
context:
space:
mode:
authorDavid Lechner <dlechner@baylibre.com>2025-01-15 14:48:27 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-01-23 17:22:54 +0100
commiteed792d9894c0e1c83f8c008d2613d98f8e5348b (patch)
treefcc4f7661784c220a33924d878e06720d7a3be84 /scripts/patch-kernel
parent9e2d61c4dcd8adf5755a6a7106476993926fc225 (diff)
downloadlinux-eed792d9894c0e1c83f8c008d2613d98f8e5348b.tar.gz
linux-eed792d9894c0e1c83f8c008d2613d98f8e5348b.tar.bz2
linux-eed792d9894c0e1c83f8c008d2613d98f8e5348b.zip
hwmon: (ltc2991) Fix mixed signed/unsigned in DIV_ROUND_CLOSEST
[ Upstream commit e9b24deb84863c5a77dda5be57b6cb5bf4127b85 ] Fix use of DIV_ROUND_CLOSEST where a possibly negative value is divided by an unsigned type by casting the unsigned type to the signed type of the same size (st->r_sense_uohm[channel] has type of u32). The docs on the DIV_ROUND_CLOSEST macro explain that dividing a negative value by an unsigned type is undefined behavior. The actual behavior is that it converts both values to unsigned before doing the division, for example: int ret = DIV_ROUND_CLOSEST(-100, 3U); results in ret == 1431655732 instead of -33. Fixes: 2b9ea4262ae9 ("hwmon: Add driver for ltc2991") Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20250115-hwmon-ltc2991-fix-div-round-closest-v1-1-b4929667e457@baylibre.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'scripts/patch-kernel')
0 files changed, 0 insertions, 0 deletions