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 DC6AA27EC6C; Wed, 23 Apr 2025 14:53:56 +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=1745420037; cv=none; b=b+Lv/+MiHajDV3ANNKwiyEhP+f7TDcV1BHJnFNYS+uDYZoykcXUJggpe0t8PVnlNvxngp1YZZ3LTmVSxbqljglDYr8EaFqsFwPR3tkFrS28SXwmL1Gm5HlDvTRQ7j14vYGxIYcLe54rJPcALI/KgFeTVB7FiHxdIAVKGprx9TYM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745420037; c=relaxed/simple; bh=LZN3AL7YY1a0bor5alRjiRgQKeMxEi22nyTzzJXwNTE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rvbs5UKR61hjiaLRKt5qM5WZztAKDotLWLDNd9H+YLUiAFJiJLO9ttSjhOI5G1bZO2iP43Qpv/C4VzxkgXbSapDcUfIwD3OzAPO6hiBgktZaYYzOLlnl+sKcDUdaqLw12/h9dhhD2jYYnSczqHGWKldVkzT6AnqTQ9gUc7mHrNY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cCpBfFf8; 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="cCpBfFf8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E959C4CEEB; Wed, 23 Apr 2025 14:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745420036; bh=LZN3AL7YY1a0bor5alRjiRgQKeMxEi22nyTzzJXwNTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cCpBfFf8nPB4UkPuJ80886Xhavv6Gj72iD081ywdw2a+31ZIjxAg8rE0wpdJwrg6a ri0lyUy2aibpQZjGzU0CzJc1VFjEapUE0IciOH8190ZzVmpgZvWr4nca8NROF5sUzY Q6F56df1kXjBcJYv5C1f6kq04m/h104jI3sgDq3I= 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.12 094/223] asus-laptop: Fix an uninitialized variable Date: Wed, 23 Apr 2025 16:42:46 +0200 Message-ID: <20250423142620.948653587@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250423142617.120834124@linuxfoundation.org> References: <20250423142617.120834124@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.12-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 @@ -426,11 +426,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