]> git.ipfire.org Git - people/arne_f/kernel.git/commit
power: supply: twl4030_charger: fix charging current out-of-bounds
authorAndreas Kemnade <andreas@kemnade.info>
Mon, 17 Sep 2018 05:20:35 +0000 (07:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Nov 2019 17:00:14 +0000 (18:00 +0100)
commitb1fdcfbdb93cc899d19091a2385edb40a07420e3
treecef0c510df37832161aca47e954323e68a33e41f
parentdcd758c0346d1f03fca83ac4f5b8b1f589a3cda1
power: supply: twl4030_charger: fix charging current out-of-bounds

[ Upstream commit 8314c212f995bc0d06b54ad02ef0ab4089781540 ]

the charging current uses unsigned int variables, if we step back
if the current is still low, we would run into negative which
means setting the target to a huge value.
Better add checks here.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/power/supply/twl4030_charger.c