From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoUTt-0007Eg-Uv for qemu-devel@nongnu.org; Wed, 12 Nov 2014 04:45:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoUTn-00086w-Qv for qemu-devel@nongnu.org; Wed, 12 Nov 2014 04:44:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoUTn-00086o-Jq for qemu-devel@nongnu.org; Wed, 12 Nov 2014 04:44:47 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAC9iktT029571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 12 Nov 2014 04:44:47 -0500 Date: Wed, 12 Nov 2014 11:44:44 +0200 From: "Michael S. Tsirkin" Message-ID: <1415785203-26938-4-git-send-email-mst@redhat.com> References: <1415785203-26938-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1415785203-26938-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PATCH 3/4] cpu: assert host pointer offset within block List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , dgilbert@redhat.com, quintela@redhat.com Make accesses safer in case we missed some check somewhere. Signed-off-by: Michael S. Tsirkin --- include/exec/cpu-all.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 9d8d408..7c3a5e7 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -315,6 +315,7 @@ typedef struct RAMBlock { static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset) { + assert(offset < block->length); return (char *)block->host + offset; } -- MST