diff options
author | Pierre-Clément Tosi <ptosi@google.com> | 2023-10-11 17:04:33 +0100 |
---|---|---|
committer | Pierre-Clément Tosi <ptosi@google.com> | 2023-10-11 18:35:27 +0100 |
commit | f20cff01e7e83ef976787bab1571568d64c0b11d (patch) | |
tree | 0e1a630aa36cc870862b33bdacc8deb040997d01 | |
parent | 824645385979cf00626c048fcc5443e7209af458 (diff) | |
download | dtc-f20cff01e7e83ef976787bab1571568d64c0b11d.tar.gz |
ANDROID: Revert "libfdt: Validate alias property value is a valid string."
This reverts commit 9308e7f9772bd226fea9925b1fc4d53c127ed4d5.
Revert the Android patch to apply the upstream fix [1] instead.
[1]: https://android.googlesource.com/platform/external/dtc/+/79b9e326a162b15ca5758ee214e350f4f7c038fe
Test: N/A
Change-Id: I702e619c875449b5efda529d01350117a1c4a435
-rw-r--r-- | libfdt/fdt_ro.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c index 362cc4a..e61df25 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -10,14 +10,6 @@ #include "libfdt_internal.h" -/* Check if a buffer contains a nul-terminated string. - * Used for checking property values which should be strings. - */ -static bool is_nul_string(const char *buf, const size_t buf_len) { - return buf_len > 0 && buf[buf_len - 1] == '\0' && - strnlen(buf, buf_len) == buf_len - 1; -} - static int fdt_nodename_eq_(const void *fdt, int offset, const char *s, int len) { @@ -536,27 +528,13 @@ uint32_t fdt_get_phandle(const void *fdt, int nodeoffset) const char *fdt_get_alias_namelen(const void *fdt, const char *name, int namelen) { - const char *prop; int aliasoffset; - int prop_len; aliasoffset = fdt_path_offset(fdt, "/aliases"); if (aliasoffset < 0) return NULL; - prop = fdt_getprop_namelen(fdt, aliasoffset, name, namelen, &prop_len); - if (prop && !can_assume(VALID_INPUT)) { - /* Validate the alias value. From the devicetree spec v0.3: - * "An alias value is a device path and is encoded as a string. - * The value representes the full path to a node, ..." - * A full path must start at the root to prevent recursion. - */ - if (prop_len == 0 || *prop != '/' || !is_nul_string(prop, prop_len)) { - prop = NULL; - } - } - - return prop; + return fdt_getprop_namelen(fdt, aliasoffset, name, namelen, NULL); } const char *fdt_get_alias(const void *fdt, const char *name) |