summaryrefslogtreecommitdiff
path: root/boot/bootmeth-uclass.c
diff options
context:
space:
mode:
Diffstat (limited to 'boot/bootmeth-uclass.c')
-rw-r--r--boot/bootmeth-uclass.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c
index 188f6ea1895..a9709465f6e 100644
--- a/boot/bootmeth-uclass.c
+++ b/boot/bootmeth-uclass.c
@@ -204,11 +204,23 @@ int bootmeth_setup_iter_order(struct bootflow_iter *iter, bool include_global)
goto err_order;
}
+ /* start with the global bootmeths */
if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && include_global &&
iter->first_glob_method != -1 && iter->first_glob_method != count) {
iter->cur_method = iter->first_glob_method;
iter->doing_global = true;
+ iter->have_global = true;
}
+
+ /*
+ * check we don't exceed the maximum bits in methods_done when tracking
+ * which global bootmeths have run
+ */
+ if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && count > BOOTMETH_MAX_COUNT) {
+ free(order);
+ return log_msg_ret("tmb", -ENOSPC);
+ }
+
iter->method_order = order;
iter->num_methods = count;