From: Dan Carpenter <dan.carpenter@linaro.org>
Date: Tue, 25 Jul 2023 06:50:26 +0000 (+0300)
Subject: cmd: Fix a size parameter in test_readonly()
X-Git-Tag: v2025.01-rc5-pxa1908~847^2~40^2~15
X-Git-Url: http://git.dujemihanovic.xyz/%22http:/kyber.dk/phpMyBuilder/static/%7B%7B%20%24style.Permalink%20%7D%7D?a=commitdiff_plain;h=57175285774751ca751d3d5e9f045d6af95ea43b;p=u-boot.git

cmd: Fix a size parameter in test_readonly()

The parentheses are in the wrong place so this passes the number of
bytes to write as "sizeof(index_0) != TPM_SUCCESS" when just
"sizeof(index_0)" was intended.  (1 byte vs 4 bytes).

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---

diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c
index c4ed8e5901..9bdc9c660f 100644
--- a/cmd/tpm_test.c
+++ b/cmd/tpm_test.c
@@ -294,8 +294,8 @@ static int test_readonly(struct udevice *dev)
 	 */
 	index_0 += 1;
 	if (tpm_nv_write_value(dev, INDEX0, (uint8_t *)&index_0,
-			       sizeof(index_0) !=
-		TPM_SUCCESS)) {
+			       sizeof(index_0)) !=
+		TPM_SUCCESS) {
 		pr_err("\tcould not write index 0\n");
 	}
 	tpm_nv_write_value_lock(dev, INDEX0);