[PATCH 07/14] fastboot: handle ill-named partitions gracefully

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Apr 12 23:34:55 BST 2021


Users can configure a partition name of bbu-something that would
conflict at fastboot init time with a barebox update "something"
handler. Current behavior is to silently ignore all remaining
barebox update handlers.

It would be better to complain loudly and to skip only the entries
actually conflicting. Do so.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/fastboot.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/fastboot.c b/common/fastboot.c
index a394d07e28df..c8576a8d97c3 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -158,10 +158,12 @@ static int fastboot_add_bbu_variables(struct bbu_handler *handler, void *ctx)
 	name = basprintf("bbu-%s", handler->name);
 
 	ret = file_list_add_entry(fb->files, name, handler->devicefile, 0);
+	if (ret)
+		pr_warn("duplicate partition name %s\n", name);
 
 	free(name);
 
-	return ret;
+	return 0;
 }
 
 int fastboot_generic_init(struct fastboot *fb, bool export_bbu)
-- 
2.29.2




More information about the barebox mailing list