Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32dc29cf authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman
Browse files

cros_ec: fix nul-termination for firmware build info




[ Upstream commit 50a0d71a5d20e1d3eff1d974fdc8559ad6d74892 ]

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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarBenson Leung <bleung@chromium.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a50521b0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ static ssize_t show_ec_version(struct device *dev,
		count += scnprintf(buf + count, PAGE_SIZE - count,
				   "Build info:    EC error %d\n", msg->result);
	else {
		msg->data[sizeof(msg->data) - 1] = '\0';
		msg->data[EC_HOST_PARAM_SIZE - 1] = '\0';
		count += scnprintf(buf + count, PAGE_SIZE - count,
				   "Build info:    %s\n", msg->data);
	}