From patchwork Thu Oct 17 16:48:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 21100 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F25B5246F1 for ; Thu, 17 Oct 2013 16:48:52 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id wm4sf5811476obc.4 for ; Thu, 17 Oct 2013 09:48:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state: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=Kwtjb+9D2uY9nvgJjLK+1/1jKfUB0NUSsGeX2LCNU7tlG/aB8HzvVnb8PpH8fzj3Ab RBzb7sRc0ubbZcMm+dtIzgJ5L5/8+OIk+h65XRy4OMglPPQ1TZv4Z9HRbXDnNxElQGp1 aUvA05eJXEcW7uO2n/IvC0+W6Yif6Qp/I23yQZHzuexH8YcYb1SAKhOwZuSYrTdxt+qx C5wU/Xwh//01gzB7cEezBeHcIfX5YfUeSKL4wNU0nGqp1flAJVXEdt39ST1IvoB87mal DR9iF3R2TaFdAFa4iH2Wn+SHwZ32qwgiuZhsAEHZkwioKY2LQ/G8CZA9AVL7arY4tIRa 1ROA== X-Received: by 10.182.19.133 with SMTP id f5mr3325217obe.36.1382028532512; Thu, 17 Oct 2013 09:48:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.3.231 with SMTP id f7ls960041qef.61.gmail; Thu, 17 Oct 2013 09:48:52 -0700 (PDT) X-Received: by 10.58.161.231 with SMTP id xv7mr7470584veb.2.1382028532407; Thu, 17 Oct 2013 09:48:52 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id bz3si26518631vcb.123.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Oct 2013 09:48:52 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id lh4so1265913vcb.23 for ; Thu, 17 Oct 2013 09:48:52 -0700 (PDT) X-Gm-Message-State: ALoCoQmpUw901t1AUIfGqRzcdTqI+FRQB5BoWd92hS00DRMayCBck04fDzbBcVh0EiYSEAfRH0ex X-Received: by 10.220.105.199 with SMTP id u7mr7392203vco.1.1382028532107; Thu, 17 Oct 2013 09:48:52 -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 u4csp134444vcz; Thu, 17 Oct 2013 09:48:51 -0700 (PDT) X-Received: by 10.180.92.100 with SMTP id cl4mr3703439wib.1.1382028529432; Thu, 17 Oct 2013 09:48:49 -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 de7si31016446wjc.82.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 17 Oct 2013 09:48:49 -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 1VWqkg-0000Ty-79; Thu, 17 Oct 2013 17:48:46 +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 v8 1/3] device_tree.c: Terminate the empty reservemap in create_device_tree() Date: Thu, 17 Oct 2013 17:48:44 +0100 Message-Id: <1382028526-1826-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1382028526-1826-1-git-send-email-peter.maydell@linaro.org> References: <1382028526-1826-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.220.178 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;