From nobody Mon May 6 18:18:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 151305223178157.50510160892895; Mon, 11 Dec 2017 20:17:11 -0800 (PST) Received: from localhost ([::1]:56593 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOc02-0005va-Ic for importer@patchew.org; Mon, 11 Dec 2017 23:16:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eObyz-0005Vx-TJ for qemu-devel@nongnu.org; Mon, 11 Dec 2017 23:15:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eObyy-00081U-V7 for qemu-devel@nongnu.org; Mon, 11 Dec 2017 23:15:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eObyt-0007xt-7u; Mon, 11 Dec 2017 23:15:47 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 25F997E42C; Tue, 12 Dec 2017 04:15:46 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-106.sin2.redhat.com [10.67.116.106]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E2C2617B94; Tue, 12 Dec 2017 04:15:43 +0000 (UTC) From: P J P To: Qemu Developers Date: Tue, 12 Dec 2017 09:45:39 +0530 Message-Id: <20171212041539.25700-1-ppandit@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 12 Dec 2017 04:15:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1] display: limit irq handler index to TC6393XB_GPIOS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Moguofang , Prasad J Pandit Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Prasad J Pandit The ctz32() routine could return value greater than TC6393XB_GPIOS=3D16. This could lead to an OOB array access. Mask 'level' to avoid it. Reported-by: Moguofang Signed-off-by: Prasad J Pandit --- hw/display/tc6393xb.c | 1 + 1 file changed, 1 insertion(+) Update: mask 'level' value to TC6393XB_GPIOS=3D16 -> https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg01685.html diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c index 74d10af3d4..0ae63605f0 100644 --- a/hw/display/tc6393xb.c +++ b/hw/display/tc6393xb.c @@ -172,6 +172,7 @@ static void tc6393xb_gpio_handler_update(TC6393xbState = *s) int bit; =20 level =3D s->gpio_level & s->gpio_dir; + level &=3D MAKE_64BIT_MASK(0, TC6393XB_GPIOS); =20 for (diff =3D s->prev_level ^ level; diff; diff ^=3D 1 << bit) { bit =3D ctz32(diff); --=20 2.13.6