Browse Source

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>
Shawn Nematbakhsh 8 years ago
parent
commit
73b44f40c6
1 changed files with 3 additions and 3 deletions
  1. 3 3
      drivers/platform/chrome/cros_ec_debugfs.c

+ 3 - 3
drivers/platform/chrome/cros_ec_debugfs.c

@@ -227,14 +227,14 @@ static int ec_read_version_supported(struct cros_ec_dev *ec)
 
 
 	struct cros_ec_command *msg;
 	struct cros_ec_command *msg;
 
 
-	msg = kzalloc(sizeof(*msg) + max(sizeof(params), sizeof(response)),
+	msg = kzalloc(sizeof(*msg) + max(sizeof(*params), sizeof(*response)),
 		GFP_KERNEL);
 		GFP_KERNEL);
 	if (!msg)
 	if (!msg)
 		return 0;
 		return 0;
 
 
 	msg->command = EC_CMD_GET_CMD_VERSIONS + ec->cmd_offset;
 	msg->command = EC_CMD_GET_CMD_VERSIONS + ec->cmd_offset;
-	msg->outsize = sizeof(params);
-	msg->insize = sizeof(response);
+	msg->outsize = sizeof(*params);
+	msg->insize = sizeof(*response);
 
 
 	params = (struct ec_params_get_cmd_versions_v1 *)msg->data;
 	params = (struct ec_params_get_cmd_versions_v1 *)msg->data;
 	params->cmd = EC_CMD_CONSOLE_READ;
 	params->cmd = EC_CMD_CONSOLE_READ;