From patchwork Fri Mar 4 15:13:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 63603 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp130757lbc; Fri, 4 Mar 2016 07:13:49 -0800 (PST) X-Received: by 10.98.18.28 with SMTP id a28mr12762079pfj.145.1457104429232; Fri, 04 Mar 2016 07:13:49 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p81si6368924pfa.102.2016.03.04.07.13.48; Fri, 04 Mar 2016 07:13:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758478AbcCDPNr (ORCPT + 6 others); Fri, 4 Mar 2016 10:13:47 -0500 Received: from mail-oi0-f46.google.com ([209.85.218.46]:34039 "EHLO mail-oi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758436AbcCDPNq (ORCPT ); Fri, 4 Mar 2016 10:13:46 -0500 Received: by mail-oi0-f46.google.com with SMTP id m82so39591383oif.1; Fri, 04 Mar 2016 07:13:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=j0dH9cGQk22NMvb02u383twprYGjYYYTqOvwv8iMna4=; b=eDjLKqKtPUH0+k1jrJyPztHWjCdULYo+Yd/DN8Yo1Xgwr/g/b+fJUcfnRpIh3WpKPk jUYzVmEvuprBUJZdD9r2ir/FsnTckeMIXKqUWtMhag07q5wqW9dbQh0cjpFdf9Ibyc6A 9yNzgJNdobnA9ZF05dH45Q+abxBIOQYTpJef+qJw9us8fnNhAgiRask6yVYH9WOtaiGY xMA9oGhP7mgF2Kn5IvNUu8naOKvNlTDuAirFlQ0lICcI74nfb5BA4s9LoLzae+xlZlkF BFJSyTZmk5E9ehVCouunKKtWQ0hytNZ54+zm+mabAvj6brVe8n6TwYkqFefCOFvKw82m UAUg== X-Gm-Message-State: AD7BkJL935Nbl+9DZGs+0KG3RDwbwMF+WataQhCLBAgFElIxB9pUkBv6QKfbP4unvWQTPw== X-Received: by 10.202.102.69 with SMTP id a66mr6235871oic.93.1457104425529; Fri, 04 Mar 2016 07:13:45 -0800 (PST) Received: from rob-hp-laptop.herring.priv (72-48-98-129.dyn.grandenetworks.net. [72.48.98.129]) by smtp.googlemail.com with ESMTPSA id q189sm2390055oia.7.2016.03.04.07.13.44 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2016 07:13:45 -0800 (PST) From: Rob Herring To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scripts/dtc: Update to upstream version 53bf130b1cdd Date: Fri, 4 Mar 2016 09:13:40 -0600 Message-Id: <1457104420-18350-1-git-send-email-robh@kernel.org> X-Mailer: git-send-email 2.5.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Sync to upstream dtc commit 53bf130b1cdd ("libfdt: simplify fdt_node_check_compatible()"). This adds the following commits from upstream: 53bf130 libfdt: simplify fdt_node_check_compatible() c9d9121 Warn on node name unit-address presence/absence mismatch 2e53f9d Catch unsigned 32bit overflow when parsing flattened device tree offsets Signed-off-by: Rob Herring --- As usual, this is just an automated copy of upstream dtc into the kernel tree. The changeset is small enough that I have left it here. The main reason for this sync is to pick-up the new unit-address warnings. Rob scripts/dtc/checks.c | 26 ++++++++++++++++++++++++++ scripts/dtc/flattree.c | 4 ++-- scripts/dtc/libfdt/fdt_ro.c | 6 ++---- scripts/dtc/version_gen.h | 2 +- 4 files changed, 31 insertions(+), 7 deletions(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c index 0c03ac9..386f956 100644 --- a/scripts/dtc/checks.c +++ b/scripts/dtc/checks.c @@ -294,6 +294,30 @@ static void check_node_name_format(struct check *c, struct node *dt, } NODE_ERROR(node_name_format, NULL, &node_name_chars); +static void check_unit_address_vs_reg(struct check *c, struct node *dt, + struct node *node) +{ + const char *unitname = get_unitname(node); + struct property *prop = get_property(node, "reg"); + + if (!prop) { + prop = get_property(node, "ranges"); + if (prop && !prop->val.len) + prop = NULL; + } + + if (prop) { + if (!unitname[0]) + FAIL(c, "Node %s has a reg or ranges property, but no unit name", + node->fullpath); + } else { + if (unitname[0]) + FAIL(c, "Node %s has a unit name, but no reg property", + node->fullpath); + } +} +NODE_WARNING(unit_address_vs_reg, NULL); + static void check_property_name_chars(struct check *c, struct node *dt, struct node *node, struct property *prop) { @@ -667,6 +691,8 @@ static struct check *check_table[] = { &addr_size_cells, ®_format, &ranges_format, + &unit_address_vs_reg, + &avoid_default_addr_size, &obsolete_chosen_interrupt_controller, diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c index bd99fa2..ec14954 100644 --- a/scripts/dtc/flattree.c +++ b/scripts/dtc/flattree.c @@ -889,7 +889,7 @@ struct boot_info *dt_from_blob(const char *fname) if (version >= 3) { uint32_t size_str = fdt32_to_cpu(fdt->size_dt_strings); - if (off_str+size_str > totalsize) + if ((off_str+size_str < off_str) || (off_str+size_str > totalsize)) die("String table extends past total size\n"); inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str); } else { @@ -898,7 +898,7 @@ struct boot_info *dt_from_blob(const char *fname) if (version >= 17) { size_dt = fdt32_to_cpu(fdt->size_dt_struct); - if (off_dt+size_dt > totalsize) + if ((off_dt+size_dt < off_dt) || (off_dt+size_dt > totalsize)) die("Structure block extends past total size\n"); } diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c index e5b3136..50cce86 100644 --- a/scripts/dtc/libfdt/fdt_ro.c +++ b/scripts/dtc/libfdt/fdt_ro.c @@ -647,10 +647,8 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset, prop = fdt_getprop(fdt, nodeoffset, "compatible", &len); if (!prop) return len; - if (fdt_stringlist_contains(prop, len, compatible)) - return 0; - else - return 1; + + return !fdt_stringlist_contains(prop, len, compatible); } int fdt_node_offset_by_compatible(const void *fdt, int startoffset, diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h index 11d93e6..ad9b05a 100644 --- a/scripts/dtc/version_gen.h +++ b/scripts/dtc/version_gen.h @@ -1 +1 @@ -#define DTC_VERSION "DTC 1.4.1-gb06e55c8" +#define DTC_VERSION "DTC 1.4.1-g53bf130b"