mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
libfdt: Fix use of uninitialized variable in fdt_get_path()
My recent implemenetation of fdt_get_path() had a bug - the while loop tested offset which was unitialized on the first iteration. Depending on code surrounding the call, this could cause fdt_get_path() to return incorrect results. This patch corrects the problem by applying some more correct thinking to the loop condition. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
7ca330865e
commit
e2b3bb3227
1 changed files with 1 additions and 1 deletions
|
@ -302,7 +302,7 @@ int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
|
|||
buf[0] = '/';
|
||||
p = 1;
|
||||
|
||||
while (offset < nodeoffset) {
|
||||
while (nextoffset <= nodeoffset) {
|
||||
offset = nextoffset;
|
||||
tag = _fdt_next_tag(fdt, offset, &nextoffset);
|
||||
switch (tag) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue