From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F1DB28D84D; Wed, 23 Apr 2025 15:25:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745421939; cv=none; b=ACAsmBbui683Wr+7SnF6rdvR0QFxyExPYyfTccfeOwqx2ybfeoyB95mBWrWGGImr8CUJR8l/SacQST8tMeNQ7uqYcy1jhEmD95EOBq7mjDc5EEjvWiVCcWHiexV1X5amLgZiAT8gkyw/BbiO2bwm1dmgV+Df2cZYtBf6Gl1uLLY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745421939; c=relaxed/simple; bh=ifrlf4BUVlvkB0+5HLv1v79yVHY+Hg2wLl7anqT7/Ww=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j8WqUOUNj5fbOK/r2zChUPwUA0qD0Ofk3SRkDQUNK7jAOWI27Wl5hGcqQfSMx6GQGcgiwLXGo8EAaHR5ePqvf15KIwb1gPGugbrPafQ1lIcrMz9Z4XCiYGWw5DEfVOE/Bf9l18D848koqyLpqMBOdoyE+Aixyx18N74F9KfAZq0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uZJ+eRa8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="uZJ+eRa8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0320FC4CEE2; Wed, 23 Apr 2025 15:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745421939; bh=ifrlf4BUVlvkB0+5HLv1v79yVHY+Hg2wLl7anqT7/Ww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uZJ+eRa8UP0bQ+odYvNDW6OXQzcnM/XamJNYBhmhG9NNQXj/XASzd2mcQzLdIFVbc jc7T4zc+PzRo0ZOH36J0hVWQY4/palj1RN6G9wldifBSwZtAABs3wQMf+t4Lw+hxTd EDhJ6rYJ5Ual+YpSYOVJeEFBbbhArdYPoLhjTkkc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Denis Arefev , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 6.1 202/291] asus-laptop: Fix an uninitialized variable Date: Wed, 23 Apr 2025 16:43:11 +0200 Message-ID: <20250423142632.632824738@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250423142624.409452181@linuxfoundation.org> References: <20250423142624.409452181@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Denis Arefev commit 6c683c6887e4addcd6bd1ddce08cafccb0a21e32 upstream. The value returned by acpi_evaluate_integer() is not checked, but the result is not always successful, so it is necessary to add a check of the returned value. If the result remains negative during three iterations of the loop, then the uninitialized variable 'val' will be used in the clamp_val() macro, so it must be initialized with the current value of the 'curr' variable. In this case, the algorithm should be less noisy. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: b23910c2194e ("asus-laptop: Pegatron Lucid accelerometer") Cc: stable@vger.kernel.org Signed-off-by: Denis Arefev Link: https://lore.kernel.org/r/20250403122603.18172-1-arefev@swemel.ru Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/asus-laptop.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c @@ -427,11 +427,14 @@ static int asus_pega_lucid_set(struct as static int pega_acc_axis(struct asus_laptop *asus, int curr, char *method) { + unsigned long long val = (unsigned long long)curr; + acpi_status status; int i, delta; - unsigned long long val; - for (i = 0; i < PEGA_ACC_RETRIES; i++) { - acpi_evaluate_integer(asus->handle, method, NULL, &val); + for (i = 0; i < PEGA_ACC_RETRIES; i++) { + status = acpi_evaluate_integer(asus->handle, method, NULL, &val); + if (ACPI_FAILURE(status)) + continue; /* The output is noisy. From reading the ASL * dissassembly, timeout errors are returned with 1's * in the high word, and the lack of locking around