From patchwork Fri Mar 22 10:57:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 781835 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp1273428wrj; Fri, 22 Mar 2024 03:58:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWnoPf8Zpdl/W/L0jiIZl2ZodphaVedkhLEiNXUFoO+cLWOkaEjEZW32OU7SGADPS4PjKMT+uno8RqjuZfhNiVx X-Google-Smtp-Source: AGHT+IHMfRJfhGlkkMq27WOndxfhb1+kQkFd6pVWCcTvZsCdT0lfawYx+4IQ5e+EXvn0+YO+Opm1 X-Received: by 2002:a19:640f:0:b0:512:9e78:998c with SMTP id y15-20020a19640f000000b005129e78998cmr1313826lfb.9.1711105115688; Fri, 22 Mar 2024 03:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711105115; cv=none; d=google.com; s=arc-20160816; b=moUgL6qFGV0tRL9ztOfpMXfOhmKZjNPDsIAy4qSQRW4h9MoSzf2CuNXdl0bStL4lLf K9GN+p0BAYbd44VcXRoZgGRACO4VGX4NWe5pi6nvukLX9OMF76MMKkNtkZRhMKKl4XYa IjOdIsy7s41QDbQ1fQ9BFa6qFcJMGUEGb+6ju/tR0Xod2z23Ts2eMZvRK9jnegGw9x58 Gd/0wHxK3vIlpw5YRXi4buuQRQpw3gY4pFKN2Y7S64FXr8YKLHKMPSnsx7++RVhDOXJ3 AYYn5Xvq/ju0IOcvqd4xfVQp3cc3b1Hycb5iIyc16J4y62IFhWUtaRmtLBno4Jv9TMgg 5Dwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=iruGxkmrzWtYVIKVv/US6QnhCQmEwhlDglanL7x+fgg=; fh=0OBOeNvG1YwOz62VjCAPxJsyowuZOMIwtNTktJXXBMY=; b=tM+RjCZFmkKNAdilPpZoqL5CWRwn6atqyMypU0HRcDZ5RKOT1FoE+0ShIkr1aZ3Mi4 Jtj2j+6w65llKOPr02mJ/+KBxPM9Z3PifleID/et2S2xFqQtO6m42gNrgFyb2YHs3RxB M5hgj+wHMNYhg3lHFIGobFXo6STjHTcPb/ZR5cZf4A81P2x+xytB5Siw4CBR4SR1jTt6 i9ougC0bceBF1sqFYkB8dLiamOMesiQLianydPjhCbb2lLEL+7nVzU6tXf14lBQeMWtx 9Nfx9bpauxYEhAPlZewUKDCk84W+G2F3LCvCCgxkbzC9jnzOiffQKeiqjfqH1d+allF1 ue6w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id dj12-20020a0560000b0c00b0033e7835ac6asi863037wrb.738.2024.03.22.03.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 03:58:35 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F01EE881CD; Fri, 22 Mar 2024 11:58:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 1A7CC88113; Fri, 22 Mar 2024 11:58:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 2764A881C2 for ; Fri, 22 Mar 2024 11:58:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B8BAF1007; Fri, 22 Mar 2024 03:58:48 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9DA1D3F64C; Fri, 22 Mar 2024 03:58:11 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Yann GAUTIER , Etienne Carriere , Patrick DELAUNAY - foss , Michal Simek , Masahisa Kojima , Michal Simek , Sughosh Ganu Subject: [PATCH v3 02/20] tools: mkfwumdata: fix the size parameter to the fwrite call Date: Fri, 22 Mar 2024 16:27:15 +0530 Message-Id: <20240322105733.203888-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240322105733.203888-1-sughosh.ganu@linaro.org> References: <20240322105733.203888-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 --- 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