未验证 提交 d4d2313a 编写于 作者: E Emil Karlson 提交者: Benson Leung

mfd: cros-ec: copy the whole event in get_next_event_xfer

Commit 57e94c8b caused cros-ec keyboard events
be truncated on many chromebooks so that Left and Right keys on Column 12 were
always 0. Use ret as memcpy len to fix this.

The old code was using ec_dev->event_size, which is the event payload/data size
excluding event_type header, for the length of the memcpy operation. Use ret
as memcpy length to avoid the off by one and copy the whole msg->data.

Fixes: 57e94c8b ("mfd: cros-ec: Increase maximum mkbp event size")
Acked-by: NEnric Balletbo i Serra <enric.balletbo@collabora.com>
Tested-by: NEmil Renner Berthing <kernel@esmil.dk>
Signed-off-by: NEmil Karlson <jekarlson@gmail.com>
Signed-off-by: NBenson Leung <bleung@chromium.org>
上级 0238df64
......@@ -520,7 +520,7 @@ static int get_next_event_xfer(struct cros_ec_device *ec_dev,
ret = cros_ec_cmd_xfer(ec_dev, msg);
if (ret > 0) {
ec_dev->event_size = ret - 1;
memcpy(&ec_dev->event_data, msg->data, ec_dev->event_size);
memcpy(&ec_dev->event_data, msg->data, ret);
}
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册