OSDN Git Service

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>
Fri, 22 Nov 2019 13:43:38 +0000 (14:43 +0100)
commitfebdf3b61d5cd5069a72fb44d4efd2f98dc6e4e1
tree2997fbe05770b3b4ccec6d019e8944e7f08a4e61
parent03d25539cb67f8fbd6f57475eaeaeb9f8b5d8a7b
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/twl4030_charger.c