Skip to content

Commit 4dea417

Browse files
void0redrafaeljw
authored andcommitted
ACPI: processor: Check for null return of devm_kzalloc() in fch_misc_setup()
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>
1 parent e8d018d commit 4dea417

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)