linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: APEI: Check NULL argument in exported symbol
@ 2021-09-23 19:56 Vasyl Gomonovych
  2021-09-23 20:48 ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Vasyl Gomonovych @ 2021-09-23 19:56 UTC (permalink / raw)
  To: rafael, lenb, james.morse
  Cc: Vasyl Gomonovych, Tony Luck, Borislav Petkov, Randy Dunlap,
	Yazen Ghannam, Robert Richter, Tom Saeger, linux-acpi,
	linux-kernel

Exported symbol apei_hest_parse is external API
and should check pointer argument

Signed-off-by: Vasyl Gomonovych <vgomonovych@marvell.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [PATCH] ACPI: APEI: Check NULL argument in exported symbol
@ 2021-09-24 15:25 Vasyl Gomonovych
  2021-09-24 16:11 ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Vasyl Gomonovych @ 2021-09-24 15:25 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: rafael, lenb, james.morse, Tony Luck, Randy Dunlap,
	Yazen Ghannam, Robert Richter, Tom Saeger, linux-acpi,
	linux-kernel

> Looking at this more, that apei_hest_parse() thng should be made static and the export dropped.
I found  apei_hest_parse() useful API to access the HEST table.
I think RAS development should increase the number of users of apei_hest_parse().
With this API we can read HEST and modify it.
Read example is to get a count of errors sources from HEST tables from the external driver and use that counter for driver data allocation.
One of write example is to patch error_status_address, if firmware change 
memory layout based on boot conditions, error_status_address from hest.asl can require shift which can be recognized by driver.
Currently my RAS development underway and I recognize that legal and open way to touch HEST table is 
via apei_hest_parse() from external driver. 
Abstraction layer between driver main purposes and setup procedure HEST access utilize mainly apei_hest_parse(). 
From  this perspective apei_hest_parse() become central function in access abstraction. 
That is why I thought to make this check. But of course user should be responsible for own way of access.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-24 16:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 19:56 [PATCH] ACPI: APEI: Check NULL argument in exported symbol Vasyl Gomonovych
2021-09-23 20:48 ` Borislav Petkov
2021-09-23 21:03   ` Borislav Petkov
2021-09-24 15:25 Vasyl Gomonovych
2021-09-24 16:11 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).