From patchwork Wed Dec 13 01:58: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: 121700 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4884575qgn; Tue, 12 Dec 2017 18:00:37 -0800 (PST) X-Google-Smtp-Source: ACJfBotUyf7I6/1RK1s60tjwJV19Clqwq1ttvK9Evxg5iSacXasK0Wcv89YWavG6oa18UDFsPH+t X-Received: by 10.84.246.197 with SMTP id j5mr4293233plt.168.1513130437160; Tue, 12 Dec 2017 18:00:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513130437; cv=none; d=google.com; s=arc-20160816; b=ttt2KerYYnrEswc3oXK59ZCUKPdAjLC3ytV+pI8qbb2HzUA/8swT4bEPk5tR/ULCR8 UXJMe1vMx9JHVuPj3OjnOstxskhPWXeo9MuWZtImX0SSZP3lPZBzXi4UeL8RkDM0tEj0 ZikE7Le2T4TxWsudPjhiHmhVa2RzxhEXK2fIsiGMWhxEJtYdyqn41aW/FpWmivr3Y1BL PA/eJXu4jEU8oGIoOderYhzPNImaZKpw7OTSHFzzX53En1TJP8Vxjb3/KumPWAbXp+6v SPv8hKzvrJVkEyaz7epa66yANencNDNilTxaS8YzCjqy3jMXYyP4Kn62nyJdGFvGtqjZ DztA== 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=lmHbMNj7W2gaXNKIA8LNiCDN5qJuDpZ4DVgQjtVsbnfbg58HbTrSMIhEc2aem5KesV URUIpzK9c90gNmQpwX8NN1/e9rgQM/Jm82E4HMLh7dfH4/QuPVCWvIDqEFTb95v3zOZy 89cLDgnzd4mg6JOBi8k3qnLGq1D7fFy+NShr5ocqCbOVSEXtSAet0dmG7zC2ylvnGrzf sWn+sAtKCUGwEVqkttEJ9FyA3uk2L6Ps5K2PMURGpQEBUyLXINrOtuNPnVqKcQ0s2c1S CmvDR+LeMNNyPtqr5yDVbPsJZQf30g+AFHzKjZ2i5l/wlYWoE1kzmxYIX3kJHSC2A2Rr pRmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=HDSQZQXW; dkim=fail header.i=@verizon.com header.s=corp header.b=qG1+P/XI; dkim=fail header.i=@verizon.com header.s=corp header.b=BAYXCYbc; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 x6si400804pgp.181.2017.12.12.18.00.36; Tue, 12 Dec 2017 18:00:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=HDSQZQXW; dkim=fail header.i=@verizon.com header.s=corp header.b=qG1+P/XI; dkim=fail header.i=@verizon.com header.s=corp header.b=BAYXCYbc; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 S1752951AbdLMCAf (ORCPT + 10 others); Tue, 12 Dec 2017 21:00:35 -0500 Received: from omzsmtpe01.verizonbusiness.com ([199.249.25.210]:35576 "EHLO omzsmtpe01.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753297AbdLMCA3 (ORCPT ); Tue, 12 Dec 2017 21:00:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130429; x=1544666429; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=heb6R2cmPQc+YGUc/+76JrfPTAdHAoRZI990hDokSHs=; b=HDSQZQXWhMdmO9QQsS8eAsjuoA2JJiQ+amgcf+j64iCfwNEU3VOG2Hcz lkoxFzXbjf0kuowm03v/WNJrXZdrmoGoKjNVbFMEhNWIw7QpH+xIph8SU q2jVFqYCeoQdy+U2wC6A+J3VkwQC/QBzbpiqbUohUyO65k83Ua18daq/X o=; Received: from unknown (HELO fldsmtpi01.verizon.com) ([166.68.71.143]) by omzsmtpe01.verizonbusiness.com with ESMTP; 13 Dec 2017 02:00:19 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO apollo.verizonwireless.com) ([10.255.192.101]) by fldsmtpi01.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Dec 2017 02:00:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130402; x=1544666402; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=heb6R2cmPQc+YGUc/+76JrfPTAdHAoRZI990hDokSHs=; b=qG1+P/XIUeHuh5f9XuDzB0oB0Tzb7oWZXYF4hsGIYI7at5epO0njnqQE NLoOU2jW69VL5SlDEFygKNtVT3aaJWrY9tt6rk9/AB0GM8sq9mL32jZjV ZWma7D6CQT3sl7HW8oM3SXVv9FQWvEuPJEP4gRR+CSAqRywg7i1qqa/s/ 8=; Received: from surveyor.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.83]) by apollo.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Dec 2017 21:00:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130401; x=1544666401; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=heb6R2cmPQc+YGUc/+76JrfPTAdHAoRZI990hDokSHs=; b=BAYXCYbcOuYMW45yAmq4/+q6j+LC5TEd6jlnfbFXg3UDlY0onWGI8S7x 7KmU9m5vTfOWkNYAIrQZqpAXUvd9IIilhRZe++EKK0rg4i5U9nlDv2jKU /48q/lGJGs3G6JH4kfXiVq7ZS/7RsAtcnJHgUtKqvaW9e7S+l86BgAZAP Q=; From: alexander.levin@verizon.com Cc: Arnd Bergmann , Guenter Roeck , alexander.levin@verizon.com X-Host: surveyor.tdc.vzwcorp.com Received: from ohtwi1exh003.uswin.ad.vzwcorp.com ([10.144.218.45]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 13 Dec 2017 02:00:01 +0000 Received: from tbwexch05apd.uswin.ad.vzwcorp.com (153.114.162.29) by OHTWI1EXH003.uswin.ad.vzwcorp.com (10.144.218.45) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 12 Dec 2017 21:00:01 -0500 Received: from OMZP1LUMXCA14.uswin.ad.vzwcorp.com (144.8.22.189) by tbwexch05apd.uswin.ad.vzwcorp.com (153.114.162.29) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 21:00:00 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA14.uswin.ad.vzwcorp.com (144.8.22.189) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 19:59:59 -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:59:59 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.4 21/59] hwmon: (asus_atk0110) fix uninitialized data access Thread-Topic: [PATCH AUTOSEL for 4.4 21/59] hwmon: (asus_atk0110) fix uninitialized data access Thread-Index: AQHTc7Xg5D7K/IWdcU6pQQKrl0IEAQ== Date: Wed, 13 Dec 2017 01:58:31 +0000 Message-ID: <20171213015817.6950-21-alexander.levin@verizon.com> References: <20171213015817.6950-1-alexander.levin@verizon.com> In-Reply-To: <20171213015817.6950-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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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;