From: "Jan Beulich" Subject: [PATCH] qemu-traditional/passthrough: fix off-by-one in PCI config space register index check Date: Mon, 25 Jun 2012 11:50:08 +0100 Message-ID: <4FE85E80020000780008BA99@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartFDD35770.1__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Rolu , xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartFDD35770.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Register 255 (0xff) is still valid to be accessed. Reported-by: Rolu Signed-off-by: Jan Beulich --- a/hw/pass-through.c +++ b/hw/pass-through.c @@ -1538,7 +1538,7 @@ static void pt_pci_write_config(PCIDevic #endif =20 /* check offset range */ - if (address >=3D 0xFF) + if (address > 0xFF) { PT_LOG_DEV(d, "Error: Failed to write register with offset = exceeding FFh. " "[Offset:%02xh][Length:%d]\n", address, len); @@ -1714,7 +1714,7 @@ static uint32_t pt_pci_read_config(PCIDe int ret =3D 0; =20 /* check offset range */ - if (address >=3D 0xFF) + if (address > 0xFF) { PT_LOG_DEV(d, "Error: Failed to read register with offset = exceeding FFh. " "[Offset:%02xh][Length:%d]\n", address, len); --=__PartFDD35770.1__= Content-Type: text/plain; name="qemu-PCI-config-space-range.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="qemu-PCI-config-space-range.patch" qemu-traditional/passthrough: fix off-by-one in PCI config space register = index check=0A=0ARegister 255 (0xff) is still valid to be accessed.=0A=0ARe= ported-by: Rolu =0ASigned-off-by: Jan Beulich =0A=0A--- a/hw/pass-through.c=0A+++ b/hw/pass-through.c=0A@@ -1538,7 = +1538,7 @@ static void pt_pci_write_config(PCIDevic=0A #endif=0A =0A = /* check offset range */=0A- if (address >=3D 0xFF)=0A+ if (address = > 0xFF)=0A {=0A PT_LOG_DEV(d, "Error: Failed to write register = with offset exceeding FFh. "=0A "[Offset:%02xh][Length:%d]\n", = address, len);=0A@@ -1714,7 +1714,7 @@ static uint32_t pt_pci_read_config(P= CIDe=0A int ret =3D 0;=0A =0A /* check offset range */=0A- if = (address >=3D 0xFF)=0A+ if (address > 0xFF)=0A {=0A = PT_LOG_DEV(d, "Error: Failed to read register with offset exceeding FFh. = "=0A "[Offset:%02xh][Length:%d]\n", address, len);=0A --=__PartFDD35770.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartFDD35770.1__=--