libfdt: Teach fdt_path_offset() about ':' path separator
Subsystems (2)
PATCH 1/1 libfdt: Teach fdt_path_offset() about ':' path separator
stdout-path defines ':' as a path separator and commit 75c28c09af99a ("of: add optional options parameter to of_find_node_by_path()") added the necessary support to parse paths terminated with ':' path separator. commit 7914a7c5651a5 ("of: support passing console options with stdout-path") added options string support to the stdout-path property, which broke earlycon.
Add the same support to fdt_path_offset() so earlycon can parse and process stdout-path properties containing an options string.
--- scripts/dtc/libfdt/fdt_ro.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
scripts/dtc/libfdt/fdt_ro.c +5 -4
@@ -156,7 +156,8 @@ int fdt_subnode_offset(const void *fdt, int parentoffset,int fdt_path_offset (const void *fdt,const char *path) { -const char *end = path +strlen (path); +const char *separator =strchr (path,':' ); +const char *end = separator ? separator : path +strlen (path);const char *p = path;int offset =0 ;
@@ -166,7 +167,7 @@ int fdt_path_offset(const void *fdt, const char *path)if (*path !='/' ) {const char *q =strchr (path,'/' ); -if (!q) +if (!q || q > end) q = end; p =fdt_get_alias_namelen (fdt, p, q - p);
@@ -177,7 +178,7 @@ int fdt_path_offset(const void *fdt, const char *path) p = q; } -while (*p) { +while (p < end) {const char *q;while (*p =='/' )
@@ -185,7 +186,7 @@ int fdt_path_offset(const void *fdt, const char *path)if (! *p)return offset; q =strchr (p,'/' ); -if (! q) +if (!q || q > end) q = end; offset =fdt_subnode_offset_namelen (fdt, offset, p, q-p);
Signature · 1 line
2.3.1
Quoted 7 lines · Peter Hurley
stdout-path defines ':' as a path separator and commit
75c28c09af99a("of: add optional options parameter toof_find_node_by_path()") added the necessary support to parse paths terminated with ':' path separator. commit7914a7c5651a5("of: support passing console options with stdout-path") added options string support to the stdout-path property, which broke earlycon.
Quoted 6 lines
Add the same support to
fdt_path_offset()so earlycon can parse and process stdout-path properties containing an options string.Cc Leif Lindholm <[email protected]>Cc <[email protected]> # 3.19+Signed-off-by Peter Hurley <[email protected]>
This needs to be first applied to upstream dtc[1]. Please do a patch against dtc and send to devicetree-compiler list.
Rob
[1] https://git.kernel.org/cgit/linux/kernel/git/jdl/dtc.git/
Quoted 46 lines
--- scripts/dtc/libfdt/fdt_ro.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)scripts/dtc/libfdt/fdt_ro.c +5
-5@@ -156,7 +156,8 @@ int fdt_subnode_offset(const void *fdt, int parentoffset,int fdt_path_offset (const void *fdt,const char *path) { -const char *end = path +strlen (path); +const char *separator =strchr (path,':' ); +const char *end = separator ? separator : path +strlen (path);const char *p = path;int offset =0 ;@@ -166,7 +167,7 @@ int fdt_path_offset(const void *fdt, const char *path)if (*path !='/' ) {const char *q =strchr (path,'/' ); -if (!q) +if (!q || q > end) q = end; p =fdt_get_alias_namelen (fdt, p, q - p);@@ -177,7 +178,7 @@ int fdt_path_offset(const void *fdt, const char *path) p = q; } -while (*p) { +while (p < end) {const char *q;while (*p =='/' )@@ -185,7 +186,7 @@ int fdt_path_offset(const void *fdt, const char *path)if (! *p)return offset; q =strchr (p,'/' ); -if (! q) +if (!q || q > end) q = end; offset =fdt_subnode_offset_namelen (fdt, offset, p, q-p); --
Quoted 2 lines
2.3.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
[ +cc Greg KH ]
Quoted 11 lines · Rob Herring
Quoted 10 lines · Peter Hurley
stdout-path defines ':' as a path separator and commit
75c28c09af99a("of: add optional options parameter toof_find_node_by_path()") added the necessary support to parse paths terminated with ':' path separator. commit7914a7c5651a5("of: support passing console options with stdout-path") added options string support to the stdout-path property, which broke earlycon.Add the same support to
fdt_path_offset()so earlycon can parse and process stdout-path properties containing an options string.
Quoted 6 lines
Quoted 3 lines
Cc Leif Lindholm <[email protected]>Cc <[email protected]> # 3.19+Signed-off-by Peter Hurley <[email protected]>This needs to be first applied to upstream dtc[1]. Please do a patch against dtc and send to devicetree-compiler list.
Sure, I can do that, but then how is this patch going to end up in 3.19-stable?
Regards,
Peter Hurley
Quoted 52 lines
Rob
[1] https://git.kernel.org/cgit/linux/kernel/git/jdl/dtc.git/
Quoted 48 lines
--- scripts/dtc/libfdt/fdt_ro.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)scripts/dtc/libfdt/fdt_ro.c +5
-5@@ -156,7 +156,8 @@ int fdt_subnode_offset(const void *fdt, int parentoffset,int fdt_path_offset (const void *fdt,const char *path) { -const char *end = path +strlen (path); +const char *separator =strchr (path,':' ); +const char *end = separator ? separator : path +strlen (path);const char *p = path;int offset =0 ;@@ -166,7 +167,7 @@ int fdt_path_offset(const void *fdt, const char *path)if (*path !='/' ) {const char *q =strchr (path,'/' ); -if (!q) +if (!q || q > end) q = end; p =fdt_get_alias_namelen (fdt, p, q - p);@@ -177,7 +178,7 @@ int fdt_path_offset(const void *fdt, const char *path) p = q; } -while (*p) { +while (p < end) {const char *q;while (*p =='/' )@@ -185,7 +186,7 @@ int fdt_path_offset(const void *fdt, const char *path)if (! *p)return offset; q =strchr (p,'/' ); -if (! q) +if (!q || q > end) q = end; offset =fdt_subnode_offset_namelen (fdt, offset, p, q-p); --2.3.1
Quoted 18 lines · Peter Hurley
[ +cc Greg KH ]
Quoted 15 lines · Rob Herring
Quoted 13 lines · Peter Hurley
stdout-path defines ':' as a path separator and commit
75c28c09af99a("of: add optional options parameter toof_find_node_by_path()") added the necessary support to parse paths terminated with ':' path separator. commit7914a7c5651a5("of: support passing console options with stdout-path") added options string support to the stdout-path property, which broke earlycon.Add the same support to
fdt_path_offset()so earlycon can parse and process stdout-path properties containing an options string.Cc Leif Lindholm <[email protected]>Cc <[email protected]> # 3.19+Signed-off-by Peter Hurley <[email protected]>
Quoted 5 lines
Quoted 2 lines
This needs to be first applied to upstream dtc[1]. Please do a patch against dtc and send to devicetree-compiler list.
Sure, I can do that, but then how is this patch going to end up in 3.19-stable?
I'll apply it tagged for stable once it is in dtc.
Rob
Quoted 52 lines
Regards,
Peter HurleyQuoted 48 lines
Rob
[1] https://git.kernel.org/cgit/linux/kernel/git/jdl/dtc.git/
Quoted 44 lines
--- scripts/dtc/libfdt/fdt_ro.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)scripts/dtc/libfdt/fdt_ro.c +5
-4@@ -156,7 +156,8 @@ int fdt_subnode_offset(const void *fdt, int parentoffset,int fdt_path_offset (const void *fdt,const char *path) { -const char *end = path +strlen (path); +const char *separator =strchr (path,':' ); +const char *end = separator ? separator : path +strlen (path);const char *p = path;int offset =0 ;@@ -166,7 +167,7 @@ int fdt_path_offset(const void *fdt, const char *path)if (*path !='/' ) {const char *q =strchr (path,'/' ); -if (!q) +if (!q || q > end) q = end; p =fdt_get_alias_namelen (fdt, p, q - p);@@ -177,7 +178,7 @@ int fdt_path_offset(const void *fdt, const char *path) p = q; } -while (*p) { +while (p < end) {const char *q;while (*p =='/' )@@ -185,7 +186,7 @@ int fdt_path_offset(const void *fdt, const char *path)if (! *p)return offset; q =strchr (p,'/' ); -if (! q) +if (!q || q > end) q = end;
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
scripts/dtc/libfdt/fdt_ro.c +0
-1offset =fdt_subnode_offset_namelen (fdt, offset, p, q-p); --2.3.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html