Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cros_ec_debugfs: Pass proper struct sizes to cros_ec_cmd_xfer()

We should output or receive every byte in the param / reply struct,
unrelated to the pointer size.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
[bleung: Picked from crosreview.com/444085 for cros_ec_debugfs.c only.
cros_ec.c upstream had a different cros_ec_sleep_event which didn't
have the sizeof issue]
Signed-off-by: Benson Leung <bleung@chromium.org>

authored by

Shawn Nematbakhsh and committed by
Benson Leung
73b44f40 e8626459

+3 -3
+3 -3
drivers/platform/chrome/cros_ec_debugfs.c
··· 227 227 228 228 struct cros_ec_command *msg; 229 229 230 - msg = kzalloc(sizeof(*msg) + max(sizeof(params), sizeof(response)), 230 + msg = kzalloc(sizeof(*msg) + max(sizeof(*params), sizeof(*response)), 231 231 GFP_KERNEL); 232 232 if (!msg) 233 233 return 0; 234 234 235 235 msg->command = EC_CMD_GET_CMD_VERSIONS + ec->cmd_offset; 236 - msg->outsize = sizeof(params); 237 - msg->insize = sizeof(response); 236 + msg->outsize = sizeof(*params); 237 + msg->insize = sizeof(*response); 238 238 239 239 params = (struct ec_params_get_cmd_versions_v1 *)msg->data; 240 240 params->cmd = EC_CMD_CONSOLE_READ;