]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hwmon: (xgene-hwmon) use appropriate type for the latency value
authorAndrey Vatoropin <a.vatoropin@crpt.ru>
Tue, 4 Feb 2025 09:54:08 +0000 (09:54 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:38:03 +0000 (14:38 +0200)
commiteae500bc8dccd30d11354c54b21f400f0f7da0cb
treef080efb6a39a391d55109a19b442018745a407db
parent7b99233dda9b20a45daaddff0f61baa7a190e1d7
hwmon: (xgene-hwmon) use appropriate type for the latency value

[ Upstream commit 8df0f002827e18632dcd986f7546c1abf1953a6f ]

The expression PCC_NUM_RETRIES * pcc_chan->latency is currently being
evaluated using 32-bit arithmetic.

Since a value of type 'u64' is used to store the eventual result,
and this result is later sent to the function usecs_to_jiffies with
input parameter unsigned int, the current data type is too wide to
store the value of ctx->usecs_lat.

Change the data type of "usecs_lat" to a more suitable (narrower) type.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru>
Link: https://lore.kernel.org/r/20250204095400.95013-1-a.vatoropin@crpt.ru
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/xgene-hwmon.c