public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
From: Bart Veer <bartv@ecoscentric.com>
To: ecos-patches@sourceware.org
Subject: fconfig patch
Date: Thu, 20 Nov 2008 21:27:00 -0000	[thread overview]
Message-ID: <pnej16hywh.fsf@delenn.bartv.net> (raw)

When running a new RedBoot on a board which had a very old RedBoot
installed, I ran into a problem with the old fconfig data. The new
RedBoot was looking for an option that did not exist in the old data.
At some point an incompatibility must have been introduced because the
new RedBoot went into an infinite loop. This patch ensures that the
loop will always move forwards through the fconfig data, preventing
the infinite loop.

Bart

2008-11-20  Bart Veer  <bartv@ecoscentric.com>

	* src/fconfig.c (flash_lookup_config): add a sanity check to
	reduce the risk of RedBoot going into an infinite loop.

Index: src/fconfig.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/fconfig.c,v
retrieving revision 1.15
diff -u -p -r1.15 fconfig.c
--- src/fconfig.c	18 Nov 2008 01:28:12 -0000	1.15
+++ src/fconfig.c	20 Nov 2008 21:19:02 -0000
@@ -838,6 +838,11 @@ flash_lookup_config(char *key)
         if (strcmp(key, CONFIG_OBJECT_KEY(dp)) == 0) {
             return dp;
         }
+        // Sanity check to prevent RedBoot going into an infinite loop when
+        // there is something dodgy in the fconfig area.
+        if (len <= 0) {
+            break;
+        }
         dp += len;
     }
 //    diag_printf("Can't find config data for '%s'\n", key);

                 reply	other threads:[~2008-11-20 21:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=pnej16hywh.fsf@delenn.bartv.net \
    --to=bartv@ecoscentric.com \
    --cc=ecos-patches@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).