From patchwork Mon Feb 12 07:47:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772041 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000971wre; Sun, 11 Feb 2024 23:50:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUi8S/Xs3cek9i6JEu7hkDmJYQkJmXfIfSo3HgzDACxMrEuYhDOJMv+4PhQacLfun1JW8YdCQXainSHQiOzWZs0 X-Google-Smtp-Source: AGHT+IE+TWKK1U8knrjK83OsGPiKMSLuZS/USh+daL7Ci5NTeIj+Cn1AajTFPt/ugdHZCWgCiaRW X-Received: by 2002:a17:906:4ad7:b0:a3c:1ed2:7c4e with SMTP id u23-20020a1709064ad700b00a3c1ed27c4emr5010243ejt.58.1707724248749; Sun, 11 Feb 2024 23:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724248; cv=none; d=google.com; s=arc-20160816; b=EMCMi9qyaBbtRFiaM9lArOWSvWJakJRk3MELY+cBRbACM1cogngnJXFpAGa/thrtwY /UMAmuoW0LUmw6HPrL6A79S4WlLiNr6ET6F4c6BPwbywJoKuYkCh5S/aBJtJWk/X6C3T H+11CFTByTpmQ9Adog/0Dl6hJjXUTPrd43PqGWX9JeQ6js6VKuSa2B5PumbSrZEpgqe1 uoG5lUD49doBArplekF57RG06KMJ+QfaX4/X7QCGW4rVZFXMlWDbGYCK0IEfcYIOSNNa Igpiop8ywf2XXqyQVaHWan35B3ZePjCnPnWLAMPZbGy+MM/hJz13XydecUj4TUEMHFSA Rxew== 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=pDuTCbFDG0irzDW5vfbmKfGo8VGdH4XL6WzaHyLMV40=; fh=REBV+iRojLHRVOJpQG0LPn5qpjEdAu2yHvIZ66cQexg=; b=Rv1ogKeQxNqie7yRxbG81L1uCYZFKTQAjhmNLWKI49qtsN08WQpEZMhy2QvdwCxsjT R6YE+txYlBQuHheC9x8Th53U+ahqm6TdJmwIGVEPX67zn5TVmbXUmgjrW9dEKFdQ3l4l fxUW8uNGs0ER5PM42abYE4KczOteEwSLTQBCTG8GZqxCcvhUDQsyvCs0xX4Mq9WRltLm rhbWnGFjFTDssiCIvpyWTOBEJpU2X3UDQfzBXtAvnJ1WZFHeWWAZoKoQvxiOe7cIzrtc HZXyE/VN2eLbV5dTu6zcHhpiR0puvSt5dfRdMxRlJyn1IPuiUuZJxUtdeCmdZLrWsVJS MWBA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=1; AJvYcCWVXHzsAOtBPUwWxE6kJOXjspCFZq7PAuLH99A9c3tDzb4AxilbF9aYhR4UGgnq7yPKGUsVD6NJl4PFrKNHHGoJUkvaOmlUD0rtTLEkjpdlAnUrn2FKgg7ikeLLogCiG0hGJr2/Xrudlr+84lSnD69fml9HGhJ7IjWkIA/pcHbW4fIzE5m7Ponop7c5Gw1fJHrJ887mePs71JfDCt9lloU07Z8U6QVkjS9ZYHBTGP6IcvCdFhtTTxwm9Xhl0tLogNjvx3HhhWp9o6a0aBObXEAxcrcamvZIx6H/asSQ4rjSlzXf5cYAhAgxsst+hX96RCsWe0YMDwTJr8DAw4aa2qUUUIlySy+dT3T6y4KYv6TGbgfd/12GU9ibFk0QGM4o+oMacDircnwWb72MYjUPTYKYrj8tY+lrU0Im8keVWlfqQHDPJbvYOL8T5ufKkSdGuzoiu1rZYGyjfGRSJxxp2gaID+LE5vVlwPvXDMxs9Oe82Vt/1wH5rEZpD5lBmnWbPciSMYStjc7+UoybRh4yc4jibKfpwJSCUxVXkYWP/0ycZcI6HiYnCxjmliMnbTbTOn0JfhRTQ2tuo9iWVSMr3ajE9jnCzU3aE0EJLQ+bQwEmgzDyfpgOyc8YSfAernnMQV9Cg79w1Q32i1pWJ2n5BFnadNzL07b9sj8TZugOUXwiUY09oXDfPX/XkW0ta+Uml2R+4pXLUPgVoQc8+tfyIk8PJc1lzBo5aP+WzdD1u/0rc5+wG1w6jIghD2rK1DzumqrEYn1Bj1gkeq3jxM2rXPAvnk6NkcHcKuhiU8uu9BgZAD0Br/h+1O/jtxULf1T/KVF+/yI4owilkD1e0oM1wSLXjN7f0NYKe93LLp9g9SzkqeA= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id f8-20020a170906084800b00a372fa51315si3706777ejd.998.2024.02.11.23.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:50:48 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 C354B87F1C; Mon, 12 Feb 2024 08:48:49 +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 15A5787F1B; Mon, 12 Feb 2024 08:48:48 +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,T_SCC_BODY_TEXT_LINE 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 CDFD687F08 for ; Mon, 12 Feb 2024 08:48:45 +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 D0166DA7; Sun, 11 Feb 2024 23:49:26 -0800 (PST) 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 0F6333F762; Sun, 11 Feb 2024 23:48:41 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima , Patrice Chotard , Patrick Delaunay , Yann Gautier , Etienne Carriere , Michal Simek , Jassi Brar , Sughosh Ganu Subject: [PATCH v2 19/21] tools: mkfwumdata: fix the size parameter to the fwrite call Date: Mon, 12 Feb 2024 13:17:10 +0530 Message-Id: <20240212074712.3657076-20-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240212074712.3657076-1-sughosh.ganu@linaro.org> References: <20240212074712.3657076-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 V1: New patch tools/mkfwumdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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