In OF_getprop(), if the "name" property doesn't exist it is synthesised
from the unit name.  If that synthesised property has an "@" in it, we
truncate the name just before the "@", but we currently continue to return
the full length of the unit name.

This diff returns the length of the truncated name.

Thanks

Tom


Index: sys/dev/ofw/fdt.c
===================================================================
RCS file: /home/OpenBSD/cvs/src/sys/dev/ofw/fdt.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 fdt.c
--- sys/dev/ofw/fdt.c   12 Jun 2016 12:55:42 -0000      1.12
+++ sys/dev/ofw/fdt.c   12 Jun 2016 20:59:31 -0000
@@ -782,8 +782,10 @@ OF_getprop(int handle, char *prop, void 
                if (data) {
                        len = strlcpy(buf, data, buflen);
                        data = strchr(buf, '@');
-                       if (data)
+                       if (data) {
                                *data = 0;
+                               return data - (char *)buf + 1;
+                       }
                        return len + 1;
                }
        }

Reply via email to