From nobody Mon May 6 03:00:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553609562041516.9677543208395; Tue, 26 Mar 2019 07:12:42 -0700 (PDT) Received: from localhost ([127.0.0.1]:60683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8mog-0004HT-VM for importer@patchew.org; Tue, 26 Mar 2019 10:12:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8miS-0007sW-M7 for qemu-devel@nongnu.org; Tue, 26 Mar 2019 10:06:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8miO-00037H-Va for qemu-devel@nongnu.org; Tue, 26 Mar 2019 10:06:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45152) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8miN-00030D-8U for qemu-devel@nongnu.org; Tue, 26 Mar 2019 10:06:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D3DB307EA8E for ; Tue, 26 Mar 2019 14:06:03 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4A026092E; Tue, 26 Mar 2019 14:06:00 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DE16417535; Tue, 26 Mar 2019 15:05:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 26 Mar 2019 15:05:58 +0100 Message-Id: <20190326140559.21476-2-kraxel@redhat.com> In-Reply-To: <20190326140559.21476-1-kraxel@redhat.com> References: <20190326140559.21476-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 26 Mar 2019 14:06:03 +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] [PULL 1/2] ohci: don't die on ED_LINK_LIMIT overflow 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: Laurent Vivier , Gerd Hoffmann 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: Laurent Vivier Stop processing the descriptor list instead. The next frame timer tick will resume the work Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1686705 Suggested-by: Gerd Hoffmann Signed-off-by: Laurent Vivier Message-id: 20190321085212.10796-1-lvivier@redhat.com Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-ohci.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 196a9f72002d..81cf5ab7a5a7 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1200,7 +1200,7 @@ static int ohci_service_ed_list(OHCIState *ohci, uint= 32_t head, int completion) if (head =3D=3D 0) return 0; =20 - for (cur =3D head; cur; cur =3D next_ed) { + for (cur =3D head; cur && link_cnt++ < ED_LINK_LIMIT; cur =3D next_ed)= { if (ohci_read_ed(ohci, cur, &ed)) { trace_usb_ohci_ed_read_error(cur); ohci_die(ohci); @@ -1209,11 +1209,6 @@ static int ohci_service_ed_list(OHCIState *ohci, uin= t32_t head, int completion) =20 next_ed =3D ed.next & OHCI_DPTR_MASK; =20 - if (++link_cnt > ED_LINK_LIMIT) { - ohci_die(ohci); - return 0; - } - if ((ed.head & OHCI_ED_H) || (ed.flags & OHCI_ED_K)) { uint32_t addr; /* Cancel pending packets for ED that have been paused. */ --=20 2.18.1 From nobody Mon May 6 03:00:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553609431457275.5137446768183; Tue, 26 Mar 2019 07:10:31 -0700 (PDT) Received: from localhost ([127.0.0.1]:60629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8mmW-0002JL-Fv for importer@patchew.org; Tue, 26 Mar 2019 10:10:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8miR-0007rZ-By for qemu-devel@nongnu.org; Tue, 26 Mar 2019 10:06:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8miO-000360-G5 for qemu-devel@nongnu.org; Tue, 26 Mar 2019 10:06:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45144) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8miN-000303-85 for qemu-devel@nongnu.org; Tue, 26 Mar 2019 10:06:07 -0400 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 46E3A307EA8C; Tue, 26 Mar 2019 14:06:03 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id A31481759E; Tue, 26 Mar 2019 14:06:00 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E6A7217536; Tue, 26 Mar 2019 15:05:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 26 Mar 2019 15:05:59 +0100 Message-Id: <20190326140559.21476-3-kraxel@redhat.com> In-Reply-To: <20190326140559.21476-1-kraxel@redhat.com> References: <20190326140559.21476-1-kraxel@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.44]); Tue, 26 Mar 2019 14:06:03 +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] [PULL 2/2] ati-vga: Fix indexed access to video memory 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: Gerd Hoffmann 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: BALATON Zoltan Coverity (CID 1399700) found that this was wrong so instead of trying to do it by hand use existing access functions that should work better. Signed-off-by: BALATON Zoltan Message-id: 20190318223842.427CB7456B2@zero.eik.bme.hu Signed-off-by: Gerd Hoffmann --- hw/display/ati.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/hw/display/ati.c b/hw/display/ati.c index 8322f52affca..db409be3c958 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -235,12 +235,9 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr,= unsigned int size) case MM_DATA ... MM_DATA + 3: /* indexed access to regs or memory */ if (s->regs.mm_index & BIT(31)) { - if (s->regs.mm_index <=3D s->vga.vram_size - size) { - int i =3D size - 1; - while (i >=3D 0) { - val <<=3D 8; - val |=3D s->vga.vram_ptr[s->regs.mm_index + i--]; - } + uint32_t idx =3D s->regs.mm_index & ~BIT(31); + if (idx <=3D s->vga.vram_size - size) { + val =3D ldn_le_p(s->vga.vram_ptr + idx, size); } } else { val =3D ati_mm_read(s, s->regs.mm_index + addr - MM_DATA, size= ); @@ -434,12 +431,9 @@ static void ati_mm_write(void *opaque, hwaddr addr, case MM_DATA ... MM_DATA + 3: /* indexed access to regs or memory */ if (s->regs.mm_index & BIT(31)) { - if (s->regs.mm_index <=3D s->vga.vram_size - size) { - int i =3D 0; - while (i < size) { - s->vga.vram_ptr[s->regs.mm_index + i] =3D data & 0xff; - data >>=3D 8; - } + uint32_t idx =3D s->regs.mm_index & ~BIT(31); + if (idx <=3D s->vga.vram_size - size) { + stn_le_p(s->vga.vram_ptr + idx, size, data); } } else { ati_mm_write(s, s->regs.mm_index + addr - MM_DATA, data, size); --=20 2.18.1