mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
backlight: pm8941: Add NULL check in wled_configure()
[ Upstream commite12d3e1624
] devm_kasprintf() returns NULL when memory allocation fails. Currently, wled_configure() does not check for this case, which results in a NULL pointer dereference. Add NULL check after devm_kasprintf() to prevent this issue. Fixes:f86b77583d
("backlight: pm8941: Convert to using %pOFn instead of device_node.name") Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250401091647.22784-1-bsdhenrymartin@gmail.com Signed-off-by: Lee Jones <lee@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
48e0b54be4
commit
1be2000b70
|
@ -1406,9 +1406,11 @@ static int wled_configure(struct wled *wled)
|
|||
wled->ctrl_addr = be32_to_cpu(*prop_addr);
|
||||
|
||||
rc = of_property_read_string(dev->of_node, "label", &wled->name);
|
||||
if (rc)
|
||||
if (rc) {
|
||||
wled->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", dev->of_node);
|
||||
|
||||
if (!wled->name)
|
||||
return -ENOMEM;
|
||||
}
|
||||
switch (wled->version) {
|
||||
case 3:
|
||||
u32_opts = wled3_opts;
|
||||
|
|
Loading…
Reference in New Issue
Block a user