summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorFrank Rowand <frank.rowand@sony.com>2018-10-04 20:32:04 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-09 09:17:24 +0200
commit15151d0013c9280921476bbeb7b43cfcc96008d6 (patch)
tree174659502a463c0e2d4afe77d49cdff4adf8b05b /include/linux
parent26dace362e7fb77a51039e91d9e15ab90b0eaac0 (diff)
downloadlinux-stable-15151d0013c9280921476bbeb7b43cfcc96008d6.tar.gz
linux-stable-15151d0013c9280921476bbeb7b43cfcc96008d6.tar.bz2
linux-stable-15151d0013c9280921476bbeb7b43cfcc96008d6.zip
of: overlay: validate overlay properties #address-cells and #size-cells
commit 6f75118800acf77f8ad6afec61ca1b2349ade371 upstream. If overlay properties #address-cells or #size-cells are already in the live devicetree for any given node, then the values in the overlay must match the values in the live tree. If the properties are already in the live tree then there is no need to create a changeset entry to add them since they must have the same value. This reduces the memory used by the changeset and eliminates a possible memory leak. Tested-by: Alan Tull <atull@kernel.org> Signed-off-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/of.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index f2c80cc4641d..d5a863c1ee39 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -968,6 +968,12 @@ static inline int of_cpu_node_to_id(struct device_node *np)
#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
#endif
+static inline int of_prop_val_eq(struct property *p1, struct property *p2)
+{
+ return p1->length == p2->length &&
+ !memcmp(p1->value, p2->value, (size_t)p1->length);
+}
+
#if defined(CONFIG_OF) && defined(CONFIG_NUMA)
extern int of_node_to_nid(struct device_node *np);
#else