Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3583283imu; Tue, 18 Dec 2018 00:24:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/W3dxA3vLyJGKz/NtvO2HeoMDrxro0klFEFyY8+pVXN3Ugrxuf2qIbY5xFv7tauH3YgIoS/ X-Received: by 2002:a17:902:9a02:: with SMTP id v2mr15979031plp.180.1545121474097; Tue, 18 Dec 2018 00:24:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545121474; cv=none; d=google.com; s=arc-20160816; b=cIxjiz54ZbQha98xXLfxS4FDx36ct1dhcvCQmlOqHk5Yxyd3DS4RB+epNFEgL3RLZF Tt97kmU0CgD/dDVbBnKZz4CyqY1Rgu4PBAhBECucPy5BOQV6OgWzVzK8r5QEUPXPO6Nw NTnPzir/glTNNUzxlimMiZE25qCV1Qy0jtDP08/B/IoQnZ3Wb8wzRbHe6clp5AdKq6D4 TQaM0BsBIgVN4gOoGbeGSgJ7zsdzTzSpE2bZ0PfaUleqiX0Ydwbtuhl4W9BfcCXyN3TJ tT66hxNh4j8RNt3nvAxgKHiVDFTtmlre0z37ewQ7in6qQ7jcRx1T+e1KbMIux/5Hnb7c S7Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=6OV+KoZiQ0wHpkXgohpa86ZtiUuP8iFfZ7zFUJIfiZ4=; b=yMH2ZVWcQDx4b2zL+K0dm4WWI6AB9eF7FXxKsriavNz5AAw3SbZCJxkVbNK3/zLrU8 mZhzabGoMi2ENPtgkiUy7OwuPnfOidLFRQQmC9C2cC1nTeIGYsQ3XVW93mcxlRElV2nj 5OSAuMXElrOk5v3/X8ftj1PLzi1NesqYfI8CFaqvnEnfWwGH2XzQsI37aNrqgfYJfgXR v+5XszjWif0Mi07T7cJkVBCqoZlcYi6/omjBhT4NL/9IVuQvRiteiV9RxMIyeWeO/0gI Dc2rdCMbdAHHcArSYzrNX+YyaC2hE8bfHUFSc2WW5BF9Hkl/d1FahZS9TweAfLx/FctX KFrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o10si2691647pgg.373.2018.12.18.00.24.18; Tue, 18 Dec 2018 00:24:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726522AbeLRIWM (ORCPT + 99 others); Tue, 18 Dec 2018 03:22:12 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:36037 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726316AbeLRIWM (ORCPT ); Tue, 18 Dec 2018 03:22:12 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id BB2809DAA8E6B; Tue, 18 Dec 2018 16:22:08 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.408.0; Tue, 18 Dec 2018 16:22:02 +0800 From: YueHaibing To: , , , , , , CC: , , , YueHaibing Subject: [PATCH -next] x86/xen: Fix read buffer overflow Date: Tue, 18 Dec 2018 16:19:10 +0800 Message-ID: <20181218081910.18080-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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