Message ID | 2685606.mvXUDI8C0e@kreacher |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2255473wrn; Tue, 24 Jan 2023 08:45:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXsAu5DWATaZjvVlNS2e5W+GTF1qidXnHp/Byj8MjCuRdsg06kZLSQwumIjDQJvyhEYDqsKF X-Received: by 2002:a05:6402:24a4:b0:49e:1f0e:e209 with SMTP id q36-20020a05640224a400b0049e1f0ee209mr34922683eda.10.1674578751902; Tue, 24 Jan 2023 08:45:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674578751; cv=none; d=google.com; s=arc-20160816; b=BvfrUtCRM+3vPcMPVGWQQyfJ+h5F/8Y67QG6S4NEiAA/RwbSpFmNinV04WcTLWMvBM DeBYDziS5QCpQAh/iPw1V6TcO/8uFQv1tjBfM8ZP1dYJnD0In4wEl81b73K9HPfITx6p xqj7DaYk1Y6lggyqDAVXkj6FbYP6urlZxEZ4IiMhDRkjmOAa70q0o7FQb/UQlqDNorOr 4LAv/SgssceMpdeZ7B5V4c/19QGuemc0hoZzr2T72P8BwobMiKkPgh6lYOLzSL3b0DLi jz3QC6fDiIJamKIJjkpN3v83uoaB6K9EDJVabp+eZ4L1499hfjkfUBP5RKB/ZH2EZZBp wdDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=bxF1rmMFBvGY3HIT0dX0ct0/9XapnkVV0WIthsPCKQA=; b=NNCdzM6OkngDiw2tBac0l9UdafKZ71XVvFT/L62Os/ShZPxBVrm5Cx6RItvbN1g6y4 3Amz0WxUsdmWcXhJceln6viH3x8e27tZ4lT+2i/+Vgvfk+4kDE5buBK+S3xfx7dZ+uWS nNG40wmUpSFfwl5755z6PYD1Q5os7FXiWE9QcgNq6cRHMjbWe8j82OUErwJ/To0dJxV0 WQ30Kgha5vIGfJibt6jtLNAlwrSU6+v+oAcl3kWRGK9gpXidTlXkkZsOGs9LSF47FLFc zWYt+17WufjE1oIUaE2B+EFV2hxHeYaBEvHlHhWdonqeASyrt9csGMNFm/9T9Mup9LvE IOOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v13-20020a056402174d00b0049e9fee3c34si3112877edx.386.2023.01.24.08.45.28; Tue, 24 Jan 2023 08:45:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233840AbjAXQix (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Tue, 24 Jan 2023 11:38:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232744AbjAXQis (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 24 Jan 2023 11:38:48 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B99540F6; Tue, 24 Jan 2023 08:38:38 -0800 (PST) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.1.0) id d69c236b73ece573; Tue, 24 Jan 2023 17:38:36 +0100 Received: from kreacher.localnet (unknown [213.134.189.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 7E9297A643A; Tue, 24 Jan 2023 17:38:35 +0100 (CET) From: "Rafael J. Wysocki" <rjw@rjwysocki.net> To: Linux PM <linux-pm@vger.kernel.org> Cc: LKML <linux-kernel@vger.kernel.org>, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Zhang Rui <rui.zhang@intel.com>, Daniel Lezcano <daniel.lezcano@linaro.org>, Dan Carpenter <error27@gmail.com> Subject: [PATCH v1] thermal: intel: int340x: Fix unitialized variable error Date: Tue, 24 Jan 2023 17:38:34 +0100 Message-ID: <2685606.mvXUDI8C0e@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.189.30 X-CLIENT-HOSTNAME: 213.134.189.30 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedruddvtddgkeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepffffffekgfehheffleetieevfeefvefhleetjedvvdeijeejledvieehueevueffnecukfhppedvudefrddufeegrddukeelrdeftdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrddukeelrdeftddphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdp rhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepvghrrhhorhdvjeesghhmrghilhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755923089331801188?= X-GMAIL-MSGID: =?utf-8?q?1755923089331801188?= |
Series |
[v1] thermal: intel: int340x: Fix unitialized variable error
|
|
Commit Message
Rafael J. Wysocki
Jan. 24, 2023, 4:38 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> If PATC evaluation fails in int340x_thermal_zone_add(), trip_cnt will not be initialized when allocating the trips array later. Address this by initializing trip_cnt to 0. While at it, move the status variable definition lower for better code readability. Fixes: d58c653e9e26 ("thermal: intel: int340x: Use generic trip points") Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On 24/01/2023 17:38, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > If PATC evaluation fails in int340x_thermal_zone_add(), trip_cnt will > not be initialized when allocating the trips array later. > > Address this by initializing trip_cnt to 0. > > While at it, move the status variable definition lower for better > code readability. > > Fixes: d58c653e9e26 ("thermal: intel: int340x: Use generic trip points") > Reported-by: Dan Carpenter <error27@gmail.com> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Index: linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -120,9 +120,9 @@ struct int34x_thermal_zone *int340x_ther int (*get_temp) (struct thermal_zone_device *, int *)) { struct int34x_thermal_zone *int34x_thermal_zone; - acpi_status status; - unsigned long long trip_cnt; + unsigned long long trip_cnt = 0; int trip_mask = 0; + acpi_status status; int i, ret; int34x_thermal_zone = kzalloc(sizeof(*int34x_thermal_zone),