[PATCH] ACPI: APEI: Check NULL argument in exported symbol

From: Vasyl Gomonovych
Date: Thu Sep 23 2021 - 15:56:44 EST


Exported symbol apei_hest_parse is external API
and should check pointer argument

Signed-off-by: Vasyl Gomonovych <vgomonovych@xxxxxxxxxxx>
---
drivers/acpi/apei/hest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
index 277f00b288d1..9f5c334c7c88 100644
--- a/drivers/acpi/apei/hest.c
+++ b/drivers/acpi/apei/hest.c
@@ -91,7 +91,7 @@ int apei_hest_parse(apei_hest_func_t func, void *data)
struct acpi_hest_header *hest_hdr;
int i, rc, len;

- if (hest_disable || !hest_tab)
+ if (hest_disable || !hest_tab || !func)
return -EINVAL;

hest_hdr = (struct acpi_hest_header *)(hest_tab + 1);
--
2.17.1