Message ID | 20210116145217.3.I964a093c91639ceefb1a21142f52b7c2ba404343@changeid |
---|---|
State | Accepted |
Commit | 698e30f7a862ae6eb4754ef0d42b8dc8cf416edd |
Delegated to: | Simon Glass |
Headers | show |
Series | cros_ec: Add features required for verified boot | expand |
This should not happen in normal operation, but the EC might have a bug,
so add a run-time check just in case.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
drivers/misc/cros_ec.c | 2 ++
1 file changed, 2 insertions(+)
Applied to u-boot-dm, thanks!
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index ce5fa5bee35..e51ac874098 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -404,6 +404,8 @@ static int ec_command(struct udevice *dev, uint cmd, int cmd_version, */ if (din && in_buffer) { assert(len <= din_len); + if (len > din_len) + return -ENOSPC; memmove(din, in_buffer, len); } }
This should not happen in normal operation, but the EC might have a bug, so add a run-time check just in case. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/misc/cros_ec.c | 2 ++ 1 file changed, 2 insertions(+)