[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181218081910.18080-1-yuehaibing@huawei.com>
Date: Tue, 18 Dec 2018 16:19:10 +0800
From: YueHaibing <yuehaibing@...wei.com>
To: <boris.ostrovsky@...cle.com>, <jgross@...e.com>,
<sstabellini@...nel.org>, <tglx@...utronix.de>, <mingo@...hat.com>,
<bp@...en8.de>, <hpa@...or.com>
CC: <linux-kernel@...r.kernel.org>, <xen-devel@...ts.xenproject.org>,
<x86@...nel.org>, YueHaibing <yuehaibing@...wei.com>
Subject: [PATCH -next] x86/xen: Fix read buffer overflow
Fix smatch warning:
arch/x86/xen/enlighten_pv.c:649 get_trap_addr() error:
buffer overflow 'early_idt_handler_array' 32 <= 32
Fixes: 42b3a4cb5609 ("x86/xen: Support early interrupts in xen pv guests")
Signed-off-by: YueHaibing <yuehaibing@...wei.com>
---
arch/x86/xen/enlighten_pv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 2f6787f..81f200d 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -646,7 +646,7 @@ static bool __ref get_trap_addr(void **addr, unsigned int ist)
if (nr == ARRAY_SIZE(trap_array) &&
*addr >= (void *)early_idt_handler_array[0] &&
- *addr < (void *)early_idt_handler_array[NUM_EXCEPTION_VECTORS]) {
+ *addr < (void *)early_idt_handler_array[NUM_EXCEPTION_VECTORS - 1]) {
nr = (*addr - (void *)early_idt_handler_array[0]) /
EARLY_IDT_HANDLER_SIZE;
*addr = (void *)xen_early_idt_handler_array[nr];
--
2.7.0
Powered by blists - more mailing lists