[PATCH v3 02/20] tools: mkfwumdata: fix the size parameter to the fwrite call

Sughosh Ganu sughosh.ganu at linaro.org
Fri Mar 22 11:57:15 CET 2024


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 at linaro.org>
---
Changes since V2: None

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

diff --git a/tools/mkfwumdata.c b/tools/mkfwumdata.c
index 9732a8ddc5..b2d90ca7c9 100644
--- a/tools/mkfwumdata.c
+++ b/tools/mkfwumdata.c
@@ -259,7 +259,7 @@ fwu_make_mdata(size_t images, size_t banks, char *uuids[], char *output)
 		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
-- 
2.34.1



More information about the U-Boot mailing list