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 7F61D27CB12; Wed, 23 Apr 2025 15:04:16 +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=1745420657; cv=none; b=lCaFkt2ibxW8iHcZ5bAswyypYsDDRzHwDFEXKxp6EcapNKzpH9WJk5jkeY88vqKhOXeNfMv/9URusAHIVGsQHMGDtszX7LGqlaaLx7jdo/Gvp4j0Y5UVuP8Bwqq496PvKe48OTQIqVvAPHMnK8Jg/y5e8h5SO46+69OXfuS/cPY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745420657; c=relaxed/simple; bh=1jDJiwgAo5D/k1M07iANLtFEcCzwOgZHM+c/bclVTuA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j/iGm0JfVcyUtPF6F7/gQP57wct/R6W38TodKtwWpVkx56exXQlic2w4B0AFlPFOvhX9VCXNJzh98zYULN6J5DfcXcEpysQry9LfO9QQrmzQ6RjT11ipYNeH3hBZOrFueX/Q3lhWqXuxhhqEW7ld77qLPPcriIM9uQrXHEoVyq8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JSphAvqe; 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="JSphAvqe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A915CC4CEE2; Wed, 23 Apr 2025 15:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745420656; bh=1jDJiwgAo5D/k1M07iANLtFEcCzwOgZHM+c/bclVTuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSphAvqe3AAb0aTp8bI8eC8ZK0Xi/Ps5JsVki3WBm7OZNsNWEqY1xfEpzkyVZC0nu XkypGCG04C+/tDrbUjgOqOQBl0SkGznqkHEiOnarFEPS//E3MySBOs1YCGFly3kf2q DHbeDCfayatEPheG0gbE2n8esiDyINGEt3xcM5V4= 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.14 111/241] asus-laptop: Fix an uninitialized variable Date: Wed, 23 Apr 2025 16:42:55 +0200 Message-ID: <20250423142625.114291047@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250423142620.525425242@linuxfoundation.org> References: <20250423142620.525425242@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.14-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