From patchwork Wed Nov 12 09:44:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 409907 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D076A14009B for ; Wed, 12 Nov 2014 20:45:53 +1100 (AEDT) Received: from localhost ([::1]:53410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoUUq-0008V5-33 for incoming@patchwork.ozlabs.org; Wed, 12 Nov 2014 04:45:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoUTw-0007Ge-Fk for qemu-devel@nongnu.org; Wed, 12 Nov 2014 04:45:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoUTq-00087b-Bu for qemu-devel@nongnu.org; Wed, 12 Nov 2014 04:44:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoUTq-00087V-58 for qemu-devel@nongnu.org; Wed, 12 Nov 2014 04:44:50 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAC9intS007559 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 12 Nov 2014 04:44:49 -0500 Received: from redhat.com (ovpn-116-58.ams2.redhat.com [10.36.116.58]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id sAC9ilMK019233; Wed, 12 Nov 2014 04:44:48 -0500 Date: Wed, 12 Nov 2014 11:44:47 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1415785203-26938-5-git-send-email-mst@redhat.com> References: <1415785203-26938-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1415785203-26938-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , dgilbert@redhat.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH 4/4] cpu: verify that block->host is set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If it isn't, access at an offset will cause memory corruption. 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 7c3a5e7..62f5581 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -316,6 +316,7 @@ typedef struct RAMBlock { static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset) { assert(offset < block->length); + assert(block->host); return (char *)block->host + offset; }