From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve2nO-0001k3-2i for qemu-devel@nongnu.org; Wed, 06 Nov 2013 08:05:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve2nH-0004sP-Kp for qemu-devel@nongnu.org; Wed, 06 Nov 2013 08:05:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:62016) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve2nH-0004sK-Dy for qemu-devel@nongnu.org; Wed, 06 Nov 2013 08:05:11 -0500 From: Juan Quintela Date: Wed, 6 Nov 2013 14:04:24 +0100 Message-Id: <1383743088-8139-16-git-send-email-quintela@redhat.com> In-Reply-To: <1383743088-8139-1-git-send-email-quintela@redhat.com> References: <1383743088-8139-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 15/39] memory: make sure that client is always inside range List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: chegu_vinod@hp.com Signed-off-by: Juan Quintela --- include/exec/memory-internal.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h index 3947caa..e08ac42 100644 --- a/include/exec/memory-internal.h +++ b/include/exec/memory-internal.h @@ -43,6 +43,7 @@ void qemu_ram_free_from_ptr(ram_addr_t addr); static inline bool cpu_physical_memory_get_dirty_flag(ram_addr_t addr, unsigned client) { + assert(client < DIRTY_MEMORY_NUM); return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] & (1 << client); } @@ -73,6 +74,7 @@ static inline int cpu_physical_memory_get_dirty(ram_addr_t start, static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr, unsigned client) { + assert(client < DIRTY_MEMORY_NUM); ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= (1 << client); } @@ -88,6 +90,8 @@ static inline int cpu_physical_memory_clear_dirty_flag(ram_addr_t addr, { int mask = ~(1 << client); + assert(client < DIRTY_MEMORY_NUM); + return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] &= mask; } -- 1.8.3.1