]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
power: supply: gpio-charger: Fix set charge current limits
authorDimitri Fedrau <dimitri.fedrau@liebherr.com>
Mon, 9 Dec 2024 10:46:15 +0000 (11:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2025 12:28:42 +0000 (13:28 +0100)
commitc3703d9340ca2820e1ac63256f4b423ea8559831
tree5e08874db1b8f4f98d7a6755f4f81bf48a9e4212
parentf60172b447317cb6c5e74b5601a151866269baf6
power: supply: gpio-charger: Fix set charge current limits

commit afc6e39e824ad0e44b2af50a97885caec8d213d1 upstream.

Fix set charge current limits for devices which allow to set the lowest
charge current limit to be greater zero. If requested charge current limit
is below lowest limit, the index equals current_limit_map_size which leads
to accessing memory beyond allocated memory.

Fixes: be2919d8355e ("power: supply: gpio-charger: add charge-current-limit feature")
Cc: stable@vger.kernel.org
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Link: https://lore.kernel.org/r/20241209-fix-charge-current-limit-v1-1-760d9b8f2af3@liebherr.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/power/supply/gpio-charger.c