kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] ACPI: APEI: EINJ: Fix check and iounmap of uninitialized pointer p
@ 2025-06-24 20:29 Colin Ian King
  2025-06-24 21:31 ` Dan Carpenter
  2025-06-25 21:40 ` Ira Weiny
  0 siblings, 2 replies; 7+ messages in thread
From: Colin Ian King @ 2025-06-24 20:29 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown, James Morse, Tony Luck,
	Borislav Petkov, Ira Weiny, linux-acpi
  Cc: kernel-janitors, linux-kernel

In the case where a request_mem_region call fails and pointer r is null
the error exit path via label 'out' will check for a non-null pointer
p and try to iounmap it. However, pointer p has not been assigned a
value at this point, so it may potentially contain any garbage value.
Fix this by ensuring pointer p is initialized to NULL.

Fixes: 1a35c88302a3 ("ACPI: APEI: EINJ: Fix kernel test sparse warnings")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/acpi/apei/einj-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
index 7930acd1d3f3..fc801587df8e 100644
--- a/drivers/acpi/apei/einj-core.c
+++ b/drivers/acpi/apei/einj-core.c
@@ -401,7 +401,7 @@ static int __einj_error_trigger(u64 trigger_paddr, u32 type,
 	u32 table_size;
 	int rc = -EIO;
 	struct acpi_generic_address *trigger_param_region = NULL;
-	struct acpi_einj_trigger __iomem *p;
+	struct acpi_einj_trigger __iomem *p = NULL;
 
 	r = request_mem_region(trigger_paddr, sizeof(trigger_tab),
 			       "APEI EINJ Trigger Table");
-- 
2.50.0


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

end of thread, other threads:[~2025-06-26 18:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-24 20:29 [PATCH][next] ACPI: APEI: EINJ: Fix check and iounmap of uninitialized pointer p Colin Ian King
2025-06-24 21:31 ` Dan Carpenter
2025-06-25 11:50   ` Dan Carpenter
2025-06-25 21:40 ` Ira Weiny
2025-06-25 21:43   ` Colin King (gmail)
2025-06-26 14:29     ` Ira Weiny
2025-06-26 18:53     ` Rafael J. Wysocki

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).