From a90af4a2e6e38cbe20af13aaa7822836c01290ae Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Sun, 15 May 2005 17:45:47 +0000 Subject: [PATCH] Bug 2750: Prevent mtrr_remove_offending from ending up in an endless loop if the offending region refuses to be removed. --- hw/xfree86/os-support/linux/lnx_video.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index 74163fdb7..cd19f109a 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -249,16 +249,15 @@ mtrr_remove_offending(int screenNum, unsigned long base, unsigned long size, wcr = &wcreturn; for (gent.regnum = 0; - ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0;) { + ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++ ) { if (gent.type == MTRR_TYPE_WRCOMB && ((gent.base >= base && gent.base + gent.size < base + size) || (gent.base > base && gent.base + gent.size <= base + size))) { *wcr = mtrr_cull_wc_region(screenNum, gent.base, gent.size, from); + if (*wcr) gent.regnum--; while(*wcr) { wcr = &((*wcr)->next); } - } else { - gent.regnum++; } } return wcreturn;