diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2017-12-08 14:13:03 +0100 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2017-12-08 16:32:18 +0100 |
commit | 589b754df3f37ca0a1f96fccde7f91c59266f38a (patch) | |
tree | 1459754b9d9acc2ffac8525bed6691e15913c6e2 | |
parent | of: overlay: Fix out-of-bounds write in init_overlay_changeset() (diff) | |
download | linux-589b754df3f37ca0a1f96fccde7f91c59266f38a.tar.xz linux-589b754df3f37ca0a1f96fccde7f91c59266f38a.zip |
of: overlay: Make node skipping in init_overlay_changeset() clearer
Make it more clear that nodes without "__overlay__" subnodes are
skipped, by reverting the logic and using continue.
This also reduces indentation level.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | drivers/of/overlay.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 83bb2edfc65c..3981b7da4fa9 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -573,18 +573,19 @@ static int init_overlay_changeset(struct overlay_changeset *ovcs, cnt = 0; for_each_child_of_node(tree, node) { overlay_node = of_get_child_by_name(node, "__overlay__"); - if (overlay_node) { - fragment = &fragments[cnt]; - fragment->overlay = overlay_node; - fragment->target = find_target_node(node); - if (!fragment->target) { - of_node_put(fragment->overlay); - ret = -EINVAL; - goto err_free_fragments; - } + if (!overlay_node) + continue; - cnt++; + fragment = &fragments[cnt]; + fragment->overlay = overlay_node; + fragment->target = find_target_node(node); + if (!fragment->target) { + of_node_put(fragment->overlay); + ret = -EINVAL; + goto err_free_fragments; } + + cnt++; } /* |