From patchwork Wed Aug 26 10:04:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 510779 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 721341401DA for ; Wed, 26 Aug 2015 20:08:01 +1000 (AEST) Received: from localhost ([::1]:37096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUXcd-0004BM-Kk for incoming@patchwork.ozlabs.org; Wed, 26 Aug 2015 06:07:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUXZ3-0006fJ-AV for qemu-devel@nongnu.org; Wed, 26 Aug 2015 06:04:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUXZ0-00069V-49 for qemu-devel@nongnu.org; Wed, 26 Aug 2015 06:04:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUXYz-00069N-Um for qemu-devel@nongnu.org; Wed, 26 Aug 2015 06:04:14 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 8A9F68CF5D; Wed, 26 Aug 2015 10:04:13 +0000 (UTC) Received: from jason-ThinkPad-T430s.nay.redhat.com (dhcp-14-122.nay.redhat.com [10.66.14.122]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7QA49k2021425; Wed, 26 Aug 2015 06:04:10 -0400 From: Jason Wang To: qemu-devel@nongnu.org Date: Wed, 26 Aug 2015 18:04:07 +0800 Message-Id: <1440583448-15797-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , Jason Wang , Greg Kurz , mst@redhat.com Subject: [Qemu-devel] [PATCH 1/2] memory: allow zero size for adjust_endianness() 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 Wildcard mmio eventfd use zero size, but it will lead abort() since it was illegal in adjust_endianness(). Fix this by allowing zero size. Cc: Greg Kurz Cc: Paolo Bonzini Signed-off-by: Jason Wang --- memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/memory.c b/memory.c index 4eb138a..134aa57 100644 --- a/memory.c +++ b/memory.c @@ -353,6 +353,7 @@ static void adjust_endianness(MemoryRegion *mr, uint64_t *data, unsigned size) { if (memory_region_wrong_endianness(mr)) { switch (size) { + case 0: case 1: break; case 2: