From patchwork Wed Dec 13 01:57:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 121717 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4919654qgn; Tue, 12 Dec 2017 18:44:25 -0800 (PST) X-Google-Smtp-Source: ACJfBou+vME7B8H3Chep1fUhK84rNVggPHMFRayxp4fzDsiaqWFkI0KsXEkEgKNKn8nr+KNOKdZk X-Received: by 10.84.238.136 with SMTP id v8mr4355281plk.381.1513133065567; Tue, 12 Dec 2017 18:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513133065; cv=none; d=google.com; s=arc-20160816; b=Ro7aUskbJ7fHL/xTNM2TkevUDPw63NVIzDJ7odxS/uXrw5uVMRlGUbcqTRak0+fXhX K7K+lCQT7h4u4zrtI3+ZEb5WVgzkSfq6b2K2p+M5GS24u1NiEvToA5g9u+xhcVxevcds ob6JX20AnhXvivBddEKKwT5Ys85XqGH3qKJAOdccV/3ZcMUq5290bDp2wwCXzLtieYP9 p8SKil4fV9uP1CBH6wEJrxcGL5Ct4vsTN/5++gDGidF8DgYvW/E1SpnuvtN6jXKtU7St 5v1msyx1qLopfhWo0YkVh1gpSfSfWPs34JdufGsUwjAbYFhKgKrxklM1x7ADqd0UeouW k+wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:cc:from:dkim-signature :dkim-signature:dkim-signature:arc-authentication-results; bh=VKcUfz1ia4idFefQJWoqYNcdD2GkcOFdjbdLY19FhQU=; b=uaRvW2IR4n6nlZOQG5ioaHYM5tJcAuudc5/6r0RyaafudyyGQxFU/kfR2wN+pZevWd El8+NBD+Ocjq3nObqF03zRqrWog3wA8n36n2QfUdgdmz78QR7pB7eySJKrVa+4D7xone Nc3tNt9L/keWvc0g27D7H9sybcpagmavDIXdQzSeQEyRJNQ56b+xJ6hzBZVoctmVa/i0 A8B2a23Nk0alvlKkXj3N/zx8Q7WCbQC/AGNJ5ryRREXxsWMFWeDXNQqRsQ/PKgNio9or f+xNc1Du0WOWoC4EhZmMkJTQTKKisUmZ8PL2Sh6qkoYrofpUvV/86wnCuCtNb/YEkjwJ BhAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=nCYNjTIM; dkim=fail header.i=@verizon.com header.s=corp header.b=eyFoK/b2; dkim=fail header.i=@verizon.com header.s=corp header.b=GukzqGHV; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si527666plj.70.2017.12.12.18.44.25; Tue, 12 Dec 2017 18:44:25 -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; dkim=fail header.i=@verizon.com header.s=corp header.b=nCYNjTIM; dkim=fail header.i=@verizon.com header.s=corp header.b=eyFoK/b2; dkim=fail header.i=@verizon.com header.s=corp header.b=GukzqGHV; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753393AbdLMCoS (ORCPT + 10 others); Tue, 12 Dec 2017 21:44:18 -0500 Received: from omzsmtpe03.verizonbusiness.com ([199.249.25.208]:6490 "EHLO omzsmtpe03.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbdLMB6O (ORCPT ); Tue, 12 Dec 2017 20:58:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130294; x=1544666294; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=heb6R2cmPQc+YGUc/+76JrfPTAdHAoRZI990hDokSHs=; b=nCYNjTIM5DKUVTWprNpUotQpzVz6mTgoZv4t0Ght4E/BLhSICOkqYwuv vPB/TkDc2QqtvMFGIwAorRhBqbPryWhTsRJ7DNL8Gy+c/jlHOlNO+DCCu c8/HyvAy76/NJKQkDusXZJjbyjEZi6J/u5wruLH5fCipir/c2OjAQmBWl 4=; Received: from unknown (HELO fldsmtpi02.verizon.com) ([166.68.71.144]) by omzsmtpe03.verizonbusiness.com with ESMTP; 13 Dec 2017 01:58:06 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO atlantis.verizonwireless.com) ([10.255.192.101]) by fldsmtpi02.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Dec 2017 01:57:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130256; x=1544666256; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=heb6R2cmPQc+YGUc/+76JrfPTAdHAoRZI990hDokSHs=; b=eyFoK/b24XysV3mhrvY1bBvkvSe0ees3Np9zA4QMgVxbQuegLM/AnuAq mPhoxiPP/4amWfzNRc6bc902zsPyXeLKQ0EAlfy29JfbLCIgfXV6fbhbt jDQirjtNF2abJcAP4VLq6VfWrLrgPwldi4MJ2dTIckTyV/vtyloNGXb2H U=; Received: from mariner.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.84]) by atlantis.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Dec 2017 20:57:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130256; x=1544666256; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=heb6R2cmPQc+YGUc/+76JrfPTAdHAoRZI990hDokSHs=; b=GukzqGHVFLxzyWnyRWk8jzKr0jeFvwUF9as3HajQzF/J0Hn3GHfOOWHj H3E7aDnz7+hGiAPiOTP/wJTp2MEB9BR+ZSmlNGipxDgyQGQrtDbzjT8KC H7gePiDFyYo8rhOnZZggpT/RwB6viiz58VFrPksw7FkNhy6AnWsqN0tOd g=; From: alexander.levin@verizon.com Cc: Arnd Bergmann , Guenter Roeck , alexander.levin@verizon.com X-Host: mariner.tdc.vzwcorp.com Received: from ohtwi1exh002.uswin.ad.vzwcorp.com ([10.144.218.44]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 13 Dec 2017 01:57:36 +0000 Received: from OHTWI1EXO910.uswin.ad.vzwcorp.com (10.144.218.210) by OHTWI1EXH002.uswin.ad.vzwcorp.com (10.144.218.44) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 12 Dec 2017 20:57:36 -0500 Received: from OMZP1LUMXCA19.uswin.ad.vzwcorp.com (144.8.22.197) by OHTWI1EXO910.uswin.ad.vzwcorp.com (10.144.218.210) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 20:57:35 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA19.uswin.ad.vzwcorp.com (144.8.22.197) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 19:57:34 -0600 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Tue, 12 Dec 2017 19:57:34 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 035/100] hwmon: (asus_atk0110) fix uninitialized data access Thread-Topic: [PATCH AUTOSEL for 4.9 035/100] hwmon: (asus_atk0110) fix uninitialized data access Thread-Index: AQHTc7W8kAHANXYFy0iEjm9S2z+iPQ== Date: Wed, 13 Dec 2017 01:57:31 +0000 Message-ID: <20171213015722.6722-10-alexander.levin@verizon.com> References: <20171213015722.6722-1-alexander.levin@verizon.com> In-Reply-To: <20171213015722.6722-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit a2125d02443e9a4e68bcfd9f8004fa23239e8329 ] The latest gcc-7 snapshot adds a warning to point out that when atk_read_value_old or atk_read_value_new fails, we copy uninitialized data into sensor->cached_value: drivers/hwmon/asus_atk0110.c: In function 'atk_input_show': drivers/hwmon/asus_atk0110.c:651:26: error: 'value' may be used uninitialized in this function [-Werror=maybe-uninitialized] Adding an error check avoids this. All versions of the driver are affected. Fixes: 2c03d07ad54d ("hwmon: Add Asus ATK0110 support") Signed-off-by: Arnd Bergmann Reviewed-by: Luca Tettamanti Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/asus_atk0110.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index cccef87963e0..975c43d446f8 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c @@ -646,6 +646,9 @@ static int atk_read_value(struct atk_sensor_data *sensor, u64 *value) else err = atk_read_value_new(sensor, value); + if (err) + return err; + sensor->is_valid = true; sensor->last_updated = jiffies; sensor->cached_value = *value;