[U-Boot] Initialize SHA buffer size var in passwd_abort

Message ID 20180112080438.26056-1-martin.etnestad@appeartv.com
State Accepted
Delegated to: Tom Rini
Headers show
Series
  • [U-Boot] Initialize SHA buffer size var in passwd_abort
Related show

Commit Message

Martin Etnestad Jan. 12, 2018, 8:04 a.m.
The call to hash_block in passwd_abort fails with error ENOSPC on some
systems. The reason is that the variable which specifies the size of the
buffer to contain the computed hash does not get initialized.

This patch initializes the variable with the size of the buffer.

Signed-off-by: Martin Etnestad <martin.etnestad@appeartv.com>
---
 common/autoboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini Jan. 28, 2018, 6:51 p.m. | #1
On Fri, Jan 12, 2018 at 09:04:38AM +0100, Martin Etnestad wrote:

> The call to hash_block in passwd_abort fails with error ENOSPC on some
> systems. The reason is that the variable which specifies the size of the
> buffer to contain the computed hash does not get initialized.
> 
> This patch initializes the variable with the size of the buffer.
> 
> Signed-off-by: Martin Etnestad <martin.etnestad@appeartv.com>

Applied to u-boot/master, thanks!

Patch

diff --git a/common/autoboot.c b/common/autoboot.c
index a011865028..2eef7a04cc 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -57,7 +57,7 @@  static int passwd_abort(uint64_t etime)
 	const char *algo_name = "sha256";
 	u_int presskey_len = 0;
 	int abort = 0;
-	int size;
+	int size = sizeof(sha);
 	int ret;
 
 	if (sha_env_str == NULL)