From patchwork Mon Dec 4 14:49:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 120558 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4525908qgn; Mon, 4 Dec 2017 06:50:30 -0800 (PST) X-Google-Smtp-Source: AGs4zMah0U9GKjlHYDY/ebHo6rP+4xUAhaGafZNaLxCGWbbkad3DNt97+hzYJrs+TQOrN/rK7mWK X-Received: by 10.98.192.7 with SMTP id x7mr19841580pff.142.1512399030213; Mon, 04 Dec 2017 06:50:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512399030; cv=none; d=google.com; s=arc-20160816; b=VbxJd9vywK+eNs6aPAy7ZZ0v+BQIQOSwQbnnOpcL1D6QAFNDEDtZ5NaH4jmhs5j1JK NL/3Ogxz942nZFtnlfbwk1z6tzWGfjfF1Y4YXQKnhhzS9Rj9k8DU8X1ZsizZ44Qdwa8+ REN9NdIgj4mEP/vvbV7/BI45tb+PZuVKPGAlC6nk6WxgchkEkVpIKXpR4eQLdDAqzoDr 8Bcg4tuts1ZwXIKIvy1OJp1i9gM1DD6YBDUqj2h3dIUBtTqJzvgogQhTl4AbRoV7XUH+ tN18SyNr2NQpaA8MYNGdp6MzrjHZPxeSFYAzi47gD1UyC67uUEEuAPAvJWL/RT6XPocA uDog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=/JQolgkK+XWmWCkjyQ/bVyyAPs0zuyj7LhXZJ5Z3K5Y=; b=MxEaA4akygMEDcczXMs+xaBaAd0zJhoxWv6YQ7rUaMF3c+5NIoXTvLzq8DLVuFSXuE PSkyPSYlJZ9dwKAwbfci3cTM6aciiRiHQ1TKwZYrAJ4go0u80L7hiTNnvpW1MkNG/2Vp QoRTVRLRnFeAPDzHjEUwrwSoD5kxw6R0aLFzwSL7ezI4xjpdcMLWwBQcXM2PtgkWMoDJ 0dCu1nWoWFnNO3L3LULcaN8ZvDiNpU9rH387IIvZsE8nvswHI6dqEY6H9gBwxnYKrysa FvVfdsKS9s0LrjeCFg8zj7HdLMHUGAWo5CDy8sIuSPWzUC9S9gTumH050LsPESEHBX3k 6+ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si1071894plr.702.2017.12.04.06.50.29; Mon, 04 Dec 2017 06:50:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754087AbdLDOu2 (ORCPT + 28 others); 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 Received: from wuerfel.lan ([149.172.96.106]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0MaRPE-1efbsv0bBA-00JqFz; Mon, 04 Dec 2017 15:50:25 +0100 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-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nhRkCAV8kQDtvubnvaBwti3R68UVDfY0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 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); }