lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOesGMg0Rrmew0iK-Gtrx_UiODhpro_S2xUxQi0gZ+7PJmBHnw@mail.gmail.com>
Date:	Wed, 18 Sep 2013 13:41:16 -0700
From:	Olof Johansson <olof@...om.net>
To:	Stephen Warren <swarren@...dotorg.org>
Cc:	Jon Loeliger <jdl@....com>,
	David Gibson <david@...son.dropbear.id.au>,
	Frank Rowand <frowand.list@...il.com>,
	Tomasz Figa <tomasz.figa@...il.com>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Rob Herring <rob.herring@...xeda.com>,
	Grant Likely <grant.likely@...retlab.ca>,
	Stephen Warren <swarren@...dia.com>
Subject: Re: [dtc RFC PATCH] Enforce node name unit-address presence/absence

On Wed, Sep 18, 2013 at 1:23 PM, Stephen Warren <swarren@...dotorg.org> wrote:
> From: Stephen Warren <swarren@...dia.com>
>
> ePAPR 1.1 section 2.2.1.1 "Node Name Requirements" specifies that any
> node that has a reg property must include a unit address in its name
> with value matching the first entry in its reg property. Conversely, if
> a node does not have a reg property, the node name must not include a
> unit address.
>
> Implement a check for this. The code doesn't validate the format of the
> unit address; ePAPR implies this may vary from binding to binding, so
> I'm not sure that it's possible to validate the value itself.
>
> Signed-off-by: Stephen Warren <swarren@...dia.com>
> ---
> This depends on my previous patch "Ensure all tests have matching reg
> and unit address".
>
> Note that this patch should not yet be applied; it will cause many real-
> world *.dts files to fail to compile. Those need to be fixed first.
> However, if/when that happens, this patch may be useful.
> ---
>  checks.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/checks.c b/checks.c
> index ee96a25..c80a055 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -287,9 +287,25 @@ NODE_ERROR(node_name_chars, PROPNODECHARS "@");
>  static void check_node_name_format(struct check *c, struct node *dt,
>                                    struct node *node)
>  {
> -       if (strchr(get_unitname(node), '@'))
> +       const char *unitname;
> +       struct property *prop;
> +
> +       unitname = get_unitname(node);
> +
> +       if (strchr(unitname, '@'))
>                 FAIL(c, "Node %s has multiple '@' characters in name",
>                      node->fullpath);
> +
> +       prop = get_property(node, "reg");
> +       if (prop) {
> +               if (!unitname[0])
> +                       FAIL(c, "Node %s has a reg 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);

These checks are very useful, even though they might sort of cross
over the domain to what a dtc linter would do instead of the compiler.

Anyway, I think it'd be better to produce warnings than errors for
this. That way we could also merge it now while the trees are fixed
up.

Also, maybe warn for @0x<foo>, which is another unpreferred syntax, it
should just be @<foo> (with foo being in hex).


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ