From nobody Thu Nov 6 12:12:21 2025 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541505487396597.1920627917525; Tue, 6 Nov 2018 03:58:07 -0800 (PST) Received: from localhost ([::1]:40603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJzzi-0005xY-C0 for importer@patchew.org; Tue, 06 Nov 2018 06:58:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJzxn-00042U-Nz for qemu-devel@nongnu.org; Tue, 06 Nov 2018 06:56:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJzxj-0007M1-JS for qemu-devel@nongnu.org; Tue, 06 Nov 2018 06:56:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60396) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJzxj-0007La-EB for qemu-devel@nongnu.org; Tue, 06 Nov 2018 06:56:03 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C9C06308213C; Tue, 6 Nov 2018 11:56:02 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-251.ams2.redhat.com [10.36.117.251]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3796418169; Tue, 6 Nov 2018 11:55:55 +0000 (UTC) From: P J P To: Qemu Developers Date: Tue, 6 Nov 2018 17:23:51 +0530 Message-Id: <20181106115351.9422-1-ppandit@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 06 Nov 2018 11:56:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] lsi53c895a: check script ram address value 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: Paolo Bonzini , Fam Zheng , Prasad J Pandit Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Prasad J Pandit While accessing script ram[2048] via 'lsi_ram_read/write' routines, 'addr' could exceed the ram range. Mask high order bits to avoid OOB access. Reported-by: Mark Kanda Signed-off-by: Prasad J Pandit --- hw/scsi/lsi53c895a.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 3f207f607c..0800df416e 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -2035,6 +2035,7 @@ static void lsi_ram_write(void *opaque, hwaddr addr, uint32_t mask; int shift; =20 + addr &=3D 0x01FFF; newval =3D s->script_ram[addr >> 2]; shift =3D (addr & 3) * 8; mask =3D ((uint64_t)1 << (size * 8)) - 1; @@ -2050,6 +2051,7 @@ static uint64_t lsi_ram_read(void *opaque, hwaddr add= r, uint32_t val; uint32_t mask; =20 + addr &=3D 0x01FFF; val =3D s->script_ram[addr >> 2]; mask =3D ((uint64_t)1 << (size * 8)) - 1; val >>=3D (addr & 3) * 8; --=20 2.17.2