提交 667a9856 编写于 作者: J Jiasheng Jiang 提交者: Zheng Zengkai

ACPI: APD: Check for NULL pointer after calling devm_ioremap()

mainline inclusion
from mainline-v5.17-rc1
commit 2cea3ec5
category: bugfix
bugzilla: 187402, https://gitee.com/openeuler/kernel/issues/I61CL6

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2cea3ec5b0099d0e9dd6752aa86e08bce38d6b32

--------------------------------

Because devres_alloc() may fail, devm_ioremap() may return NULL.

Then, 'clk_data->base' will be assigned to clkdev->data->base in
platform_device_register_data().

The PTR_ERR_OR_ZERO() check on clk_data does not cover 'base', so
it is better to add an explicit check against NULL after updating
it.

Fixes: 3f4ba94e ("ACPI: APD: Add AMD misc clock handler support")
Signed-off-by: NJiasheng Jiang <jiasheng@iscas.ac.cn>
[ rjw: Changelog rewrite ]
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 fb280a5b
......@@ -96,6 +96,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)
resource_size(rentry->res));
break;
}
if (!clk_data->base)
return -ENOMEM;
acpi_dev_free_resource_list(&resource_list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册