[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <173859530421.32012.2111021401031509145.b4-ty@collabora.com>
Date: Mon, 03 Feb 2025 16:08:24 +0100
From: Sebastian Reichel <sebastian.reichel@...labora.com>
To: Support Opensource <support.opensource@...semi.com>,
Ваторопин Андрей <a.vatoropin@...t.ru>
Cc: Sebastian Reichel <sre@...nel.org>,
Adam Thomson <Adam.Thomson.Opensource@...semi.com>,
Lee Jones <lee@...nel.org>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH] power: supply: da9150-fg: fix potential overflow
On Thu, 30 Jan 2025 09:00:34 +0000, Ваторопин Андрей wrote:
> Size of variable sd_gain equals four bytes - DA9150_QIF_SD_GAIN_SIZE.
> Size of variable shunt_val equals two bytes - DA9150_QIF_SHUNT_VAL_SIZE.
>
> The expression sd_gain * shunt_val is currently being evaluated using
> 32-bit arithmetic. So during the multiplication an overflow may occur.
>
> As the value of type 'u64' is used as storage for the eventual result, put
> ULL variable at the first position of each expression in order to give the
> compiler complete information about the proper arithmetic to use. According
> to C99 the guaranteed width for a variable of type 'unsigned long long' >=
> 64 bits.
>
> [...]
Applied, thanks!
[1/1] power: supply: da9150-fg: fix potential overflow
commit: 3fb3cb4350befc4f901c54e0cb4a2a47b1302e08
Best regards,
--
Sebastian Reichel <sebastian.reichel@...labora.com>
Powered by blists - more mailing lists