]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: mkfwumdata: fix the size parameter to the fwrite call
authorSughosh Ganu <sughosh.ganu@linaro.org>
Fri, 22 Mar 2024 10:57:15 +0000 (16:27 +0530)
committerTom Rini <trini@konsulko.com>
Fri, 24 May 2024 19:40:03 +0000 (13:40 -0600)
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>
Tested-by: Michal Simek <michal.simek@amd.com>
tools/mkfwumdata.c

index 9732a8ddc5ade85a6686e21e5d233cd3e925a703..b2d90ca7c943b8e00e28f4f6c84a716aa116ba0c 100644 (file)
@@ -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