All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: hpet: Fix to avoid potential NULL pointer dereference
@ 2019-03-19  2:19 Aditya Pakki
  2019-03-21 11:29 ` [tip:x86/urgent] x86/hpet: Prevent " tip-bot for Aditya Pakki
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-03-19  2:19 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H. Peter Anvin, x86, Kees Cook, Joe Perches, Nicolai Stange,
	Roland Dreier, linux-kernel

hpet_virt_address may be NULL when ioremap_nocache fails. The patch
checks for such a scenario and avoids NULL pointer dereference.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 arch/x86/kernel/hpet.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index dfd3aca82c61..fb32925a2e62 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -905,6 +905,8 @@ int __init hpet_enable(void)
 		return 0;
 
 	hpet_set_mapping();
+	if (!hpet_virt_address)
+		return 0;
 
 	/*
 	 * Read the period and check for a sane value:
-- 
2.17.1


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

end of thread, other threads:[~2019-03-21 11:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19  2:19 [PATCH] x86: hpet: Fix to avoid potential NULL pointer dereference Aditya Pakki
2019-03-21 11:29 ` [tip:x86/urgent] x86/hpet: Prevent " tip-bot for Aditya Pakki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.