summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMichael Tretter <m.tretter@pengutronix.de>2019-09-20 14:44:33 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-14 12:52:10 +0200
commitf72e885285976ae9e320706595511b8861f68b5b (patch)
tree7ad265ddbe2fe15a3abfb776e0230e4f8077998e /common
parentdd112643c0db33ec0ea288788c02e20d26c2be40 (diff)
downloadbarebox-f72e885285976ae9e320706595511b8861f68b5b.tar.gz
barebox-f72e885285976ae9e320706595511b8861f68b5b.tar.xz
blspec: skip entries that are not blspec entries
The list of boot entries can contain items that are not blspec entries. For example, the bootchooser also adds an item to this list. Therefore, blspec cannot unconditionally interpret entries as blspec entries. The error is reproduced by listing the boot entries with the bootchooser and a rootfs with blspec entries, e.g.: boot -l bootchooser /mnt/nfs Check if a bootentry is a blspec entry by testing if the boot function is blspec_boot. Reported-by: Thomas Hämmerle <Thomas.Haemmerle@wolfvision.net> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/blspec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/blspec.c b/common/blspec.c
index 66e5033e35..83b05993dd 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -229,6 +229,14 @@ static struct blspec_entry *blspec_entry_open(struct bootentries *bootentries,
}
/*
+ * is_blspec_entry - check if a bootentry is a blspec entry
+ */
+static inline bool is_blspec_entry(struct bootentry *entry)
+{
+ return entry->boot == blspec_boot;
+}
+
+/*
* blspec_have_entry - check if we already have an entry with
* a certain path
*/
@@ -238,6 +246,8 @@ static int blspec_have_entry(struct bootentries *bootentries, const char *path)
struct blspec_entry *e;
list_for_each_entry(be, &bootentries->entries, list) {
+ if (!is_blspec_entry(be))
+ continue;
e = container_of(be, struct blspec_entry, entry);
if (e->configpath && !strcmp(e->configpath, path))
return 1;