Received: from eggs.gnu.org ([208.118.235.92]:44760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UekGL-0003dw-P1 for qemu-devel@nongnu.org; Tue, 21 May 2013 06:57:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UekGK-0004zB-TP for qemu-devel@nongnu.org; Tue, 21 May 2013 06:57:49 -0400 Received: from mail-ea0-x22e.google.com ([2a00:1450:4013:c01::22e]:39406) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UekGK-0004yu-N7 for qemu-devel@nongnu.org; Tue, 21 May 2013 06:57:48 -0400 Received: by mail-ea0-f174.google.com with SMTP id z7so304583eaf.33 for ; Tue, 21 May 2013 03:57:48 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 21 May 2013 12:57:06 +0200 Message-Id: <1369133851-1894-6-git-send-email-pbonzini@redhat.com> In-Reply-To: <1369133851-1894-1-git-send-email-pbonzini@redhat.com> References: <1369133851-1894-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 05/30] memory: assert that PhysPageEntry's ptr does not overflow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, jan.kiszka@gmail.com, David Gibson While sized to 15 bits in PhysPageEntry, the ptr field is ORed into the iotlb entries together with a page-aligned pointer. The ptr field must not overflow into this page-aligned value, assert that it is smaller than the page size. Signed-off-by: Paolo Bonzini --- exec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exec.c b/exec.c index 1355661..380245f 100644 --- a/exec.c +++ b/exec.c @@ -713,6 +713,8 @@ static void destroy_all_mappings(AddressSpaceDispatch *d) static uint16_t phys_section_add(MemoryRegionSection *section) { + assert(phys_sections_nb < TARGET_PAGE_SIZE); + if (phys_sections_nb == phys_sections_nb_alloc) { phys_sections_nb_alloc = MAX(phys_sections_nb_alloc * 2, 16); phys_sections = g_renew(MemoryRegionSection, phys_sections, -- 1.8.1.4