Patch "power: supply: core: Initialize struct to zero" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    power: supply: core: Initialize struct to zero

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     power-supply-core-initialize-struct-to-zero.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 289f08caaed30a4d187f336fd6489171ebd9be14
Author: Linus Walleij <linus.walleij@xxxxxxxxxx>
Date:   Mon Apr 25 00:13:01 2022 +0200

    power: supply: core: Initialize struct to zero
    
    [ Upstream commit e56a4be2843c95c08cf8421dc1f8e880cafbaf91 ]
    
    As we rely on pointers in the battery info to be zero-initialized
    such as in the helper function power_supply_supports_vbat2ri()
    we certainly need to allocate the struct power_supply_battery_info
    with kzalloc() as well. Else this happens:
    
    Unable to handle kernel paging request at virtual address 00280000
    (...)
    PC is at power_supply_vbat2ri+0x50/0x12c
    LR is at ab8500_fg_battery_resistance+0x34/0x108
    
    Fixes: e9e7d165b4b0 ("power: supply: Support VBAT-to-Ri lookup tables")
    Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Signed-off-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index d925cb137e12..fad5890c899e 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -616,7 +616,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
 		goto out_put_node;
 	}
 
-	info = devm_kmalloc(&psy->dev, sizeof(*info), GFP_KERNEL);
+	info = devm_kzalloc(&psy->dev, sizeof(*info), GFP_KERNEL);
 	if (!info) {
 		err = -ENOMEM;
 		goto out_put_node;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux