From patchwork Thu Sep 12 10:17:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 20000 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f72.google.com (mail-qe0-f72.google.com [209.85.128.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7191D25E64 for ; Thu, 12 Sep 2013 10:18:01 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id 6sf12156776qea.3 for ; Thu, 12 Sep 2013 03:18:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=2qjc2xLrpOqL236gRP89OtEQcS0AyfiXGQsVLQdQ06E=; b=Y/S7VUTOnNKjSodsm4yvHUhEwgGI/5U0pcJsIjkmeYuj/LwztKnGdU1e3lK3Yyy50X TbV7S7lHRGw4MPJ+YVk1oKdsvTSyxPusL0Jj5ABE/dzgx6FhLRPyj4kfOseiFkTcF0a2 FG/iSqM6tLwDCKc0PwFnOzN7VmRbPWYJ69zqdqdwwHnjNiAEmA6pHjaRPAiijQlG/slq 1Zve3i5NO+Wwp2NeGNNfMS3VyG9mz6RIe1A60La4ymHqsMHKB2roHxccefa+dwITKSXP /n+PZfPMRFragP73qwQ+mhqHPFY8USJz1Mfk8G/e27WGB7j3ViJu6olFVsAlUFdGUM2N Nx5g== X-Gm-Message-State: ALoCoQnRFlg11NAPxBu+jsmvAYA27BzWlFCM6RMVrzwzwLArS7Go2Z61+/J6BbjctymFDKOBpSmQ X-Received: by 10.236.18.196 with SMTP id l44mr450330yhl.52.1378981081257; Thu, 12 Sep 2013 03:18:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.62.72 with SMTP id w8ls664295qer.2.gmail; Thu, 12 Sep 2013 03:18:01 -0700 (PDT) X-Received: by 10.221.64.17 with SMTP id xg17mr5923204vcb.5.1378981081018; Thu, 12 Sep 2013 03:18:01 -0700 (PDT) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by mx.google.com with ESMTPS id th8si964640veb.58.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Sep 2013 03:18:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.53; Received: by mail-vb0-f53.google.com with SMTP id i3so7207577vbh.12 for ; Thu, 12 Sep 2013 03:18:00 -0700 (PDT) X-Received: by 10.52.74.100 with SMTP id s4mr225623vdv.35.1378981080933; Thu, 12 Sep 2013 03:18:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp11661vcz; Thu, 12 Sep 2013 03:18:00 -0700 (PDT) X-Received: by 10.14.115.133 with SMTP id e5mr9845041eeh.27.1378981077888; Thu, 12 Sep 2013 03:17:57 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id e49si2381314eep.291.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 12 Sep 2013 03:17:57 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VK3yD-0002be-VM; Thu, 12 Sep 2013 11:17:53 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Alexander Graf , "Mian M. Hamayun" Subject: [PATCH v7 1/3] device_tree.c: Terminate the empty reservemap in create_device_tree() Date: Thu, 12 Sep 2013 11:17:51 +0100 Message-Id: <1378981073-9989-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1378981073-9989-1-git-send-email-peter.maydell@linaro.org> References: <1378981073-9989-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Device trees created with create_device_tree() may not have any entries in their reservemap, because the FDT API requires that the reservemap is completed before any FDT nodes are added, and create_device_tree() itself creates a node. However we were not calling fdt_finish_reservemap(), which meant that there was no terminator in the reservemap list and whatever happened to be at the start of the FDT data section would end up being interpreted as reservemap entries. Avoid this by calling fdt_finish_reservemap() to add the terminator. Signed-off-by: Peter Maydell Acked-by: Alexander Graf --- device_tree.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/device_tree.c b/device_tree.c index ffec99a..391da8c 100644 --- a/device_tree.c +++ b/device_tree.c @@ -41,6 +41,10 @@ void *create_device_tree(int *sizep) if (ret < 0) { goto fail; } + ret = fdt_finish_reservemap(fdt); + if (ret < 0) { + goto fail; + } ret = fdt_begin_node(fdt, ""); if (ret < 0) { goto fail;