[PATCH] BUG: flash_handler: decrypted-size became mandatory

45 views
Skip to first unread message

Stefano Babic

unread,
Jun 17, 2025, 10:44:40 AMJun 17
to swup...@googlegroups.com, Stefano Babic
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 <stefan...@swupdate.org>
---
handlers/flash_handler.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

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;

--
2.43.0

Reply all
Reply to author
Forward
0 new messages