From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtEAF-00035v-6P for qemu-devel@nongnu.org; Wed, 18 Dec 2013 05:15:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtEA8-0006cb-NE for qemu-devel@nongnu.org; Wed, 18 Dec 2013 05:15:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtEA8-0006cX-Dk for qemu-devel@nongnu.org; Wed, 18 Dec 2013 05:15:32 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBIAFVja016747 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 18 Dec 2013 05:15:31 -0500 Message-ID: <52B175E5.9070603@redhat.com> Date: Wed, 18 Dec 2013 12:16:05 +0200 From: Orit Wasserman MIME-Version: 1.0 References: <1387293974-24718-1-git-send-email-quintela@redhat.com> <1387293974-24718-14-git-send-email-quintela@redhat.com> In-Reply-To: <1387293974-24718-14-git-send-email-quintela@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 13/38] memory: make sure that client is always inside range List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela , qemu-devel@nongnu.org On 12/17/2013 05:25 PM, Juan Quintela wrote: > Signed-off-by: Juan Quintela > Reviewed-by: Eric Blake > --- > 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 b58010f..d09d6d8 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); > } > > @@ -74,6 +75,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); > } > > @@ -89,6 +91,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; > } > Reviewed-by: Orit Wasserman