[PATCH] 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 --- cmd/tpm_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c index c4ed8e590120..9bdc9c660fd0 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);

Thanks Dan
On Tue, 25 Jul 2023 at 09:50, Dan Carpenter dan.carpenter@linaro.org wrote:
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
cmd/tpm_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c index c4ed8e590120..9bdc9c660fd0 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);
-- 2.39.2
Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org

On Tue, Jul 25, 2023 at 09:50:26AM +0300, Dan Carpenter wrote:
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
Applied to u-boot/next, thanks!
participants (3)
-
Dan Carpenter
-
Ilias Apalodimas
-
Tom Rini