From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUTsu-00058V-0N for qemu-devel@nongnu.org; Thu, 18 Sep 2014 01:04:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUTsk-00044b-W7 for qemu-devel@nongnu.org; Thu, 18 Sep 2014 01:03:59 -0400 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]:55304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUTsk-00044K-PV for qemu-devel@nongnu.org; Thu, 18 Sep 2014 01:03:50 -0400 Received: by mail-pa0-f43.google.com with SMTP id fa1so652288pad.30 for ; Wed, 17 Sep 2014 22:03:44 -0700 (PDT) From: Max Filippov Date: Wed, 17 Sep 2014 22:03:36 -0700 Message-Id: <1411016616-29879-1-git-send-email-jcmvbkbc@gmail.com> Subject: [Qemu-devel] [PATCH] exec.c: fix setting 1-byte-long watchpoints List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Max Filippov , Peter Maydell , Richard Henderson With commit 05068c0dfb5b 'exec.c: Relax restrictions on watchpoint length and alignment' it's no longer possible to set 1-byte-long watchpoint because of incorrect address range check. Fix that by changing condition that checks for address wraparound. Signed-off-by: Max Filippov --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 2b24651..759055d 100644 --- a/exec.c +++ b/exec.c @@ -595,7 +595,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, CPUWatchpoint *wp; /* forbid ranges which are empty or run off the end of the address space */ - if (len == 0 || (addr + len - 1) <= addr) { + if (len == 0 || (addr + len - 1) < addr) { error_report("tried to set invalid watchpoint at %" VADDR_PRIx ", len=%" VADDR_PRIu, addr, len); return -EINVAL; -- 1.8.1.4