summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKory Maincent <[email protected]>2026-02-23 14:18:38 +0100
committerIlias Apalodimas <[email protected]>2026-03-26 08:20:00 +0200
commite3757929646f102070232efd86d3a308b0f54ec3 (patch)
tree37355dfa0569634888b137cfc034faf50d76c1ac
parentbcae1381f88f2122658b3aaacb04b4ea2a873a36 (diff)
tools: mkfwumdata: Add bank count validation for FWU metadata v2
The FWU metadata specification version 2 supports a maximum of 4 banks. Add validation to enforce this limit and prevent creation of non-compliant metadata structures when using version 2. Without this check, users could inadvertently create invalid metadata by specifying more than 4 banks, leading to potential compatibility issues with FWU-compliant firmware update implementations. Signed-off-by: Kory Maincent <[email protected]> Tested-by: Dario Binacchi <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
-rw-r--r--tools/fwumdata_src/mkfwumdata.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/fwumdata_src/mkfwumdata.c b/tools/fwumdata_src/mkfwumdata.c
index 5ceec7a2980..8b25539fd57 100644
--- a/tools/fwumdata_src/mkfwumdata.c
+++ b/tools/fwumdata_src/mkfwumdata.c
@@ -471,6 +471,12 @@ int main(int argc, char *argv[])
return -EINVAL;
}
+ if (version == 2 && banks > MAX_BANKS_V2) {
+ fprintf(stderr, "Error: Version 2 supports maximum %d banks, %ld requested.\n",
+ MAX_BANKS_V2, banks);
+ return -EINVAL;
+ }
+
/* This command takes UUIDs * images and output file. */
if (optind + images + 1 != argc) {
fprintf(stderr,