diff mbox series

[v2,19/21] tools: mkfwumdata: fix the size parameter to the fwrite call

Message ID 20240212074712.3657076-20-sughosh.ganu@linaro.org
State New
Headers show
Series FWU: Migrate FWU metadata to version 2 | expand

Commit Message

Sughosh Ganu Feb. 12, 2024, 7:47 a.m. UTC
The fwrite call returns the number of bytes transferred as part of the
write only when the size parameter is 1. Pass the size parameter to
the library call as 1 so that the correct number of bytes transferred
are returned.

Fixes: fdd56bfd3ad ("tools: Add mkfwumdata tool for FWU metadata image")
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---

Changes since V1: New patch

 tools/mkfwumdata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/mkfwumdata.c b/tools/mkfwumdata.c
index ab07623e25..426d221ac7 100644
--- a/tools/mkfwumdata.c
+++ b/tools/mkfwumdata.c
@@ -338,7 +338,7 @@  fwu_make_mdata(size_t images, size_t banks, const char *vendor_file,
 		goto done_make;
 	}
 
-	ret = fwrite(mobj->mdata, mobj->size, 1, file);
+	ret = fwrite(mobj->mdata, 1, mobj->size, file);
 	if (ret != mobj->size)
 		ret = -errno;
 	else