diff mbox series

BUG: flash_handler: decrypted-size became mandatory

Message ID 20250617144427.2013807-1-stefano.babic@swupdate.org
State Accepted
Headers show
Series BUG: flash_handler: decrypted-size became mandatory | expand

Commit Message

Stefano Babic June 17, 2025, 2:44 p.m. UTC
Commit 3f230e0e30 dropped the fix of 64ff18b65 to fallback to the whole
MTD size in case no decrypted-size or decompressed-size was given.
This restores the changes and uses the MTD size in case no property is
set. This avoids compatibility issues when an older SWU will be
installed using a newer SWUpdate.

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 handlers/flash_handler.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/handlers/flash_handler.c b/handlers/flash_handler.c
index 953e44eb..bf534e70 100644
--- a/handlers/flash_handler.c
+++ b/handlers/flash_handler.c
@@ -463,9 +463,14 @@  static int flash_write_image(int mtdnum, struct img_type *img)
 
 	priv.imglen = get_output_size(img, true);
 	if (priv.imglen < 0) {
-		ERROR("Failed to determine output size, bailing out.");
-		return (int)priv.imglen;
+		WARN("Failed to determine output size, getting MTD size.");
+		priv.imglen = get_mtd_size(mtdnum);
+		if (priv.imglen < 0) {
+			ERROR("Could not get MTD %d device size", mtdnum);
+			return -ENODEV;
+		}
 	}
+
 	if (!priv.imglen)
 		return 0;