From 97db5d74c7f962ec69d0d06ccea09c1fc976dae8 Mon Sep 17 00:00:00 2001 From: Mulin Chao Date: Sun, 7 Mar 2021 17:57:54 -0800 Subject: [PATCH] driver: espi: npcx: fix out-of-bounds read in espi_vw_generic_isr. Fix out-of-bounds read in espi_vw_generic_isr func. Signed-off-by: Mulin Chao --- drivers/espi/espi_npcx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/espi/espi_npcx.c b/drivers/espi/espi_npcx.c index f6a99e2e6d0..ce6928c577b 100644 --- a/drivers/espi/espi_npcx.c +++ b/drivers/espi/espi_npcx.c @@ -433,9 +433,11 @@ static void espi_vw_generic_isr(const struct device *dev, struct npcx_wui *wui) } } - if (idx == ARRAY_SIZE(vw_in_tbl)) + if (idx == ARRAY_SIZE(vw_in_tbl)) { LOG_ERR("Unknown VW event! %d %d %d", wui->table, wui->group, wui->bit); + return; + } signal = vw_in_tbl[idx].sig; if (signal == ESPI_VWIRE_SIGNAL_SLP_S3