Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754080AbdLDOu2 (ORCPT ); Mon, 4 Dec 2017 09:50:28 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:52334 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752360AbdLDOu1 (ORCPT ); Mon, 4 Dec 2017 09:50:27 -0500 From: Arnd Bergmann To: Benson Leung , Olof Johansson Cc: Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH] cros_ec: fix nul-termination for firmware build info Date: Mon, 4 Dec 2017 15:49:48 +0100 Message-Id: <20171204145014.479349-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:p4KxlQ9KPv4kXa5ABAt+L3s86C5PMr2ZyA2hIWaxE9zl6yzRW6A V2Hx+hcjaeuQTxL0JFy828d4dWIbIhpT7iWkX/iZnXuKcwfmCHDkxtgvkr9PqlNF7vvJ4Y2 79xm2itUx+bYvYqDk9QvFK7araAAfjjsn1vjR5RwhJikuDfMwt14DUWsgNCgDWZukTmMZOJ 8A6/YKe6CrUqRbdQPr1+A== X-UI-Out-Filterresults: notjunk:1;V01:K0:16End7HbKdY=:QzRPggDaGbtz2TmPJuyl+y OlV1ZBeRbVB33oBpAOpjWb5itfzfVpaxOO33/gXjfI8eZ3/0p4C+scpfpT81GoYninugEG1A1 a2qMMc+rQdkuOJYnjRwmsXD67SxujhC77fMj0MNs7eHTyOF1UdZmz7OqHBqSclaudxjUX/QN+ 2K3z4ljAAKR/Xv9RLMyO/FdbzT9L2pZWEEi8U0UTMt98hUipoNKWD6RRORJvGxYgqDC8gU81y jqYY2uUuK/4a5gFhnM1Mgc06DJxkjeay4Qddx4Ru8Q9urZnewlOU8y/WtaFMWMUxEF7TUSBK6 YNRK/4/QMJ+APzn1BblPbrMYCXDnWgeP8TjTtjtX00FrMFZqrFfZSY221L2x3E+YCEZj2xgmg RfLk7cKyzcUs48NqgRW6pp8JaJi9mzfc2nCV/HVZQYOOEuxJiduxZxW3KEMujrOfcPMrfpj08 ghTes+uYw2WWNWZyjWoBymNMXZM8jfObJZVAhySHHFQ65QXAWvcNAC2jQLvaIemCOGu8INGJA DHqb9Lcs9ttSqPOmnIBkWaYoWc3Bgf03pSHbBoZo6SRJPraBX/KOULF9vkDxdjvwhbrBJwbR0 5Fnf3l6TNctwi0VRigGe7Jh1CYp5yNkIqhKZo86E8hqNlonneo9KFEAJR/8hcKTr5eQ5sMoah Q+12i2jFhP7wngMyx7eaePSlIDMjgWkEMv/tohsC88aqnHdGugxQHMVxp1gT847JtAhqerWRC TSRgUCXZZdhu9bDCu/wPgsHeLcTnhRkCAV8kQDtvubnvaBwti3R68UVDfY0= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1194 Lines: 29 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: a841178445bb ("mfd: cros_ec: Use a zero-length array for command data") Signed-off-by: Arnd Bergmann --- drivers/platform/chrome/cros_ec_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c index f3baf9973989..24f1630a8b3f 100644 --- a/drivers/platform/chrome/cros_ec_sysfs.c +++ b/drivers/platform/chrome/cros_ec_sysfs.c @@ -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); } -- 2.9.0