From: David Gibson <david@gibson.dropbear.id.au>
To: Jon Loeliger <jdl@freescale.com>
Cc: linuxppc-dev@ozlabs.org
Subject: libfdt: Fix use of uninitialized variable in fdt_get_path()
Date: Fri, 31 Aug 2007 14:30:16 +1000 [thread overview]
Message-ID: <20070831043016.GM19271@localhost.localdomain> (raw)
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>
Index: dtc/libfdt/fdt_ro.c
===================================================================
--- dtc.orig/libfdt/fdt_ro.c 2007-08-31 14:26:26.000000000 +1000
+++ dtc/libfdt/fdt_ro.c 2007-08-31 14:26:31.000000000 +1000
@@ -302,7 +302,7 @@
buf[0] = '/';
p = 1;
- while (offset < nodeoffset) {
+ while (nextoffset <= nodeoffset) {
offset = nextoffset;
tag = _fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next reply other threads:[~2007-08-31 4:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-31 4:30 David Gibson [this message]
2007-08-31 13:38 ` libfdt: Fix use of uninitialized variable in fdt_get_path() Jon Loeliger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070831043016.GM19271@localhost.localdomain \
--to=david@gibson.dropbear.id.au \
--cc=jdl@freescale.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox