Skip to contentSkip to conversation

ACPI: APEI: Check NULL argument in exported symbol

PATCH In review Vasyl Gomonovych 2 participants 3 messages Sep 23, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: APEI: Check NULL argument in exported symbol

Exported symbol apei_hest_parse is external API
and should check pointer argument

---
 drivers/acpi/apei/hest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/apei/hest.c +1 -1
index 277f00b288d1..9f5c334c7c88 100644
@@ -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);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 2 lines · Vasyl Gomonovych

Exported symbol apei_hest_parse is external API
and should check pointer argument

Why?

All users pass a proper, non-NULL function pointer AFAICT.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#2 lore raw
Quoted 7 lines · Borislav Petkov
Quoted 2 lines · Vasyl Gomonovych

Exported symbol apei_hest_parse is external API
and should check pointer argument

Why?

All users pass a proper, non-NULL function pointer AFAICT.

Looking at this more, that apei_hest_parse() thng should be made static and the export dropped.

The last user was removed in

708b20003624 ("PCI/AER: Remove HEST/FIRMWARE_FIRST parsing for AER ownership")

You could mention it in the commit log.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette