diff mbox series

[U-Boot,14/21] cros_ec: Adjust to use v1 vboot context only

Message ID 20181124042944.239106-15-sjg@chromium.org
State Accepted
Commit eafb4a59dbb90a63c9676f16ffa1e099ee26ec28
Delegated to: Simon Glass
Headers show
Series Various patches for verified boot support | expand

Commit Message

Simon Glass Nov. 24, 2018, 4:29 a.m. UTC
At present there are no users of the 64-byte v2 context. The v1 context is
only 16 bytes long and currently an error is raised if too much data is
returned from the EC.

Update the code to limit the size to 16 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/misc/cros_ec_sandbox.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Simon Glass Dec. 5, 2018, 11:10 p.m. UTC | #1
At present there are no users of the 64-byte v2 context. The v1 context is
only 16 bytes long and currently an error is raised if too much data is
returned from the EC.

Update the code to limit the size to 16 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/misc/cros_ec_sandbox.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Applied to u-boot-dm/master, thanks!
diff mbox series

Patch

diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c
index 429f1a9b269..4fcb2d96f51 100644
--- a/drivers/misc/cros_ec_sandbox.c
+++ b/drivers/misc/cros_ec_sandbox.c
@@ -313,13 +313,15 @@  static int process_cmd(struct ec_state *ec,
 
 		switch (req->op) {
 		case EC_VBNV_CONTEXT_OP_READ:
+			/* TODO(sjg@chromium.org): Support full-size context */
 			memcpy(resp->block, ec->vbnv_context,
-			       sizeof(resp->block));
-			len = sizeof(*resp);
+			       EC_VBNV_BLOCK_SIZE);
+			len = 16;
 			break;
 		case EC_VBNV_CONTEXT_OP_WRITE:
-			memcpy(ec->vbnv_context, resp->block,
-			       sizeof(resp->block));
+			/* TODO(sjg@chromium.org): Support full-size context */
+			memcpy(ec->vbnv_context, req->block,
+			       EC_VBNV_BLOCK_SIZE);
 			len = 0;
 			break;
 		default: