linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/hpet: Fix uninitialized use in hpet_msi_resume()
@ 2019-10-08 20:47 Yizhuo
  0 siblings, 0 replies; only message in thread
From: Yizhuo @ 2019-10-08 20:47 UTC (permalink / raw)
  Cc: Yizhuo, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H. Peter Anvin, x86, linux-kernel

Inside function hpet_msi_resume(), variable "msg" could be
uninitialized if irq_chip_compose_msi_msg() returns -ENOSYS.
However, it is directly used in hpet_msi_write(),  which is
potentially unsafe.

Signed-off-by: Yizhuo <yzhai003@ucr.edu>
---
 arch/x86/kernel/hpet.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index c6f791bc481e..5bc76819dd32 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -501,6 +501,7 @@ static int hpet_clkevt_msi_resume(struct clock_event_device *evt)
 	struct irq_data *data = irq_get_irq_data(hc->irq);
 	struct msi_msg msg;
 
+	memset(&msg, 0, sizeof(struct msi_msg));
 	/* Restore the MSI msg and unmask the interrupt */
 	irq_chip_compose_msi_msg(data, &msg);
 	hpet_msi_write(hc, &msg);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-08 20:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 20:47 [PATCH] x86/hpet: Fix uninitialized use in hpet_msi_resume() Yizhuo

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