未验证 提交 50a0d71a 编写于 作者: A Arnd Bergmann 提交者: Benson Leung

cros_ec: fix nul-termination for firmware build info

As gcc-8 reports, we zero out the wrong byte:

drivers/platform/chrome/cros_ec_sysfs.c: In function 'show_ec_version':
drivers/platform/chrome/cros_ec_sysfs.c:190:12: error: array subscript 4294967295 is above array bounds of 'uint8_t[]' [-Werror=array-bounds]

This changes the code back to what it did before changing to a
zero-length array structure.

Fixes: a8411784 ("mfd: cros_ec: Use a zero-length array for command data")
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NBenson Leung <bleung@chromium.org>
上级 a376cd91
...@@ -185,7 +185,7 @@ static ssize_t show_ec_version(struct device *dev, ...@@ -185,7 +185,7 @@ static ssize_t show_ec_version(struct device *dev,
count += scnprintf(buf + count, PAGE_SIZE - count, count += scnprintf(buf + count, PAGE_SIZE - count,
"Build info: EC error %d\n", msg->result); "Build info: EC error %d\n", msg->result);
else { else {
msg->data[sizeof(msg->data) - 1] = '\0'; msg->data[EC_HOST_PARAM_SIZE - 1] = '\0';
count += scnprintf(buf + count, PAGE_SIZE - count, count += scnprintf(buf + count, PAGE_SIZE - count,
"Build info: %s\n", msg->data); "Build info: %s\n", msg->data);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册