Skip to content

Commit d433b8e

Browse files
void0redsmb49
authored andcommitted
ACPI: processor: Check for null return of devm_kzalloc() in fch_misc_setup()
BugLink: https://bugs.launchpad.net/bugs/2028808 [ Upstream commit 4dea417 ] devm_kzalloc() may fail, clk_data->name might be NULL and will cause a NULL pointer dereference later. Signed-off-by: Kang Chen <void0red@gmail.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 030fc1c commit d433b8e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/acpi/acpi_apd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)
8383
if (!acpi_dev_get_property(adev, "clk-name", ACPI_TYPE_STRING, &obj)) {
8484
clk_data->name = devm_kzalloc(&adev->dev, obj->string.length,
8585
GFP_KERNEL);
86+
if (!clk_data->name)
87+
return -ENOMEM;
8688

8789
strcpy(clk_data->name, obj->string.pointer);
8890
} else {

0 commit comments

Comments
 (0)