From patchwork Mon Sep 12 08:43:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101815 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp742124qgf; Mon, 12 Sep 2016 01:44:55 -0700 (PDT) X-Received: by 10.98.131.142 with SMTP id h136mr21270980pfe.92.1473669895879; Mon, 12 Sep 2016 01:44:55 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n81si20686442pfb.192.2016.09.12.01.44.55; Mon, 12 Sep 2016 01:44:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-media-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-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756837AbcILIob (ORCPT + 4 others); Mon, 12 Sep 2016 04:44:31 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:59374 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754932AbcILIo3 (ORCPT ); Mon, 12 Sep 2016 04:44:29 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0LorgB-1b7q673Atv-00glwD; Mon, 12 Sep 2016 10:44:08 +0200 From: Arnd Bergmann To: Hans Verkuil Cc: Arnd Bergmann , Mauro Carvalho Chehab , Greg Kroah-Hartman , Johan Fjeldtvedt , Wei Yongjun , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] pulse8-cec: avoid uninitialized data use Date: Mon, 12 Sep 2016 10:43:49 +0200 Message-Id: <20160912084403.3577996-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:Rru8xBYaaxXgMvbr1gIUdioP46uOrk372b4xebodnpTSJp6o+SM yzFXgzny72yePLqjUMapqPHiLleUDdcXIggvNZqXax3sKdEiQ9apT9smhafCnOrkU1vtgxK JavqGXljHJIaEM0m6E92ZsQM6oJaeYqEo0QA1wbRmB/nwfz8PEUJxZaHFGAMx+WQ1tK7cNe s2uXDMMnGeCTlIjEte5JQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Et4aIIIVLUw=:QSdEz4s8cIs/JCIeOCz9Sq aXGwhC3HWpeo9xwo+CuyHGG3Ig5afwjZkF3e2XiGiJN/IIi4QA+0WJTDzEOzIRKYv4BItiR7R 6iVV2SMdGDhbemGqEbWaW40SYGub77XAqRyLXxkawHePZ9kbisxlBxkvvenarUodmaq/E0WKk ZZf8WRd3hUkyI8j4QeHiXUzpnyAVb+6oAbqhhSx0bFFrQE+yJTZ0lm9AstfTOrBCgXER1COtj nCugRsnTNe8MlAGcqNWvwhN0T7rRGsvv6rnjtmV7as/7JsU7xOKoxWNeMK4N7wSTJ0T/i3QZN 7cFLzvH6ZanE7TTJzvYOuky2gDBL4fCuGMDSyBMJRvd5htFRS6Vu+h5+6ZTPpYXPMQPt75yyi ZmhsUtG8cwmrR4EmGuC89t+WQfXFLiyxnlu8mB/1b8hK4fwsPJtP4f6eyNgcUlwA3+kuiWu9l ry7g/R+0bcNMjj4ZwFKcA4nLwOEnxDG+7vv//XOUcyoN18+unUJlsh58QiVX3HxV3244Dm6Il yD5XjtTr1b/Myi/VTpF+cNblZ2FzJo5CFI75HUZMe574tF8RNhwu0CLixfoWPZMa/AsSUxVgt JpwaHGtptC/it9n+0YcoubWjFjcRAehdCBtmyInj6UcgyplWdhg3PtkcrV3KaghzQkKRjFp1o hf3I9u06M2x6bHzuTdg1Z7RN3Gnx7JAdI9ULbaBPQTk71ESUYE5BToPFgH7Jq7r45eeM= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Building with -Wmaybe-uninitialized reveals the use on an uninitialized variable containing the physical address of the device whenever firmware before version 2 is used: drivers/staging/media/pulse8-cec/pulse8-cec.c: In function 'pulse8_connect': drivers/staging/media/pulse8-cec/pulse8-cec.c:447:2: error: 'pa' may be used uninitialized in this function [-Werror=maybe-uninitialized] This sets the address to CEC_PHYS_ADDR_INVALID in this case, so we don't try to write back the uninitialized data to the device. Signed-off-by: Arnd Bergmann Fixes: e28a6c8b3fcc ("[media] pulse8-cec: sync configuration with adapter") --- drivers/staging/media/pulse8-cec/pulse8-cec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c index 1158ba9f828f..64fffc709416 100644 --- a/drivers/staging/media/pulse8-cec/pulse8-cec.c +++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c @@ -342,8 +342,10 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, return err; pulse8->vers = (data[0] << 8) | data[1]; dev_info(pulse8->dev, "Firmware version %04x\n", pulse8->vers); - if (pulse8->vers < 2) + if (pulse8->vers < 2) { + *pa = CEC_PHYS_ADDR_INVALID; return 0; + } cmd[0] = MSGCODE_GET_BUILDDATE; err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 4);