Skip to content
Commit 104bb8a6 authored by ruanjinjie's avatar ruanjinjie Committed by Sebastian Reichel
Browse files

power: supply: fix null pointer dereferencing in power_supply_get_battery_info



when kmalloc() fail to allocate memory in kasprintf(), propname
will be NULL, strcmp() called by of_get_property() will cause
null pointer dereference.

So return ENOMEM if kasprintf() return NULL pointer.

Fixes: 3afb50d7 ("power: supply: core: Add some helpers to use the battery OCV capacity table")
Signed-off-by: default avatarruanjinjie <ruanjinjie@huawei.com>
Reviewed-by: default avatarBaolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 7e6fb678
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment