diff options
author | Kang Chen | 2023-02-26 13:54:27 +0800 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-05-24 17:32:35 +0100 |
commit | 79ca94bc3e8cc3befa883c7d30b30a27ef0ea386 (patch) | |
tree | cad891aa80475ac68e0cdf6b3378b7bdfd0252eb /drivers/acpi | |
parent | cc4273233ace863f62344adeda89e06843dff88c (diff) |
ACPI: processor: Check for null return of devm_kzalloc() in fch_misc_setup()
[ Upstream commit 4dea41775d951ff1f7b472a346a8ca3ae7e74455 ]
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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpi_apd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c index 3bbe2276cac7..80f945cbec8a 100644 --- a/drivers/acpi/acpi_apd.c +++ b/drivers/acpi/acpi_apd.c @@ -83,6 +83,8 @@ static int fch_misc_setup(struct apd_private_data *pdata) if (!acpi_dev_get_property(adev, "clk-name", ACPI_TYPE_STRING, &obj)) { clk_data->name = devm_kzalloc(&adev->dev, obj->string.length, GFP_KERNEL); + if (!clk_data->name) + return -ENOMEM; strcpy(clk_data->name, obj->string.pointer); } else { |