From patchwork Fri Nov 22 17:17:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 21708 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 440E423FDB for ; Fri, 22 Nov 2013 17:17:27 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf2713756pab.3 for ; Fri, 22 Nov 2013 09:17:26 -0800 (PST) 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=AiSsXuTVNFwbp2YfFmpEw60TbAbqrwawdp3zDXlu78h++Yqf54owb5EN98DdfLQINk IqfAW8SrGN1HCRKTnPEyq3Dg4TvREFONrIrDAGGoBOz4z7mObasro62V6S6DVGYb6IjV iofcLpPZvCBEjBzxDdc8n/xf7ZCPnUNI/O1dBuPG6ohWtH6SZgS3JT6c87Fu9utKi+Gn 5pQA7TM2JdpDW+3Eork74nNfNrMEj3rgMziV03/D76D2ugVdvbqzb8GVXhsTTrGov7qd r8EKu3BfsQDQLYqJgtNrbcVt/F2bGnUfO11b9TBmcs3D6uIlKyUr56n2sCJa1WjWdHr2 wYsg== X-Gm-Message-State: ALoCoQn4FJ9aPo5k6kGvX9occdtAgogiwDhBzpGPOQKA/Con287gjv2lLuBCc6k8mUexkzXL8t4b X-Received: by 10.66.102.100 with SMTP id fn4mr461234pab.47.1385140646546; Fri, 22 Nov 2013 09:17:26 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.99.67 with SMTP id eo3ls1037042qeb.41.gmail; Fri, 22 Nov 2013 09:17:26 -0800 (PST) X-Received: by 10.52.245.9 with SMTP id xk9mr10560177vdc.8.1385140646399; Fri, 22 Nov 2013 09:17:26 -0800 (PST) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id xz7si12958079vcb.50.2013.11.22.09.17.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 09:17:26 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.42 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.42; Received: by mail-vb0-f42.google.com with SMTP id w18so1086649vbj.29 for ; Fri, 22 Nov 2013 09:17:26 -0800 (PST) X-Received: by 10.58.216.74 with SMTP id oo10mr12285732vec.0.1385140646199; Fri, 22 Nov 2013 09:17:26 -0800 (PST) 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 u4csp54995vcz; Fri, 22 Nov 2013 09:17:25 -0800 (PST) X-Received: by 10.152.180.228 with SMTP id dr4mr176591lac.32.1385140641400; Fri, 22 Nov 2013 09:17:21 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id kk3si11735811lbc.122.2013.11.22.09.17.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 Nov 2013 09:17:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VjuM2-0002j2-TD; Fri, 22 Nov 2013 17:17:18 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH v9 02/11] device_tree.c: Terminate the empty reservemap in create_device_tree() Date: Fri, 22 Nov 2013 17:17:09 +0000 Message-Id: <1385140638-10444-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1385140638-10444-1-git-send-email-peter.maydell@linaro.org> References: <1385140638-10444-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.42 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 Reviewed-by: Peter Crosthwaite --- 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;