public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Denis Arefev <arefev@swemel.ru>
Cc: Corentin Chary <corentin.chary@gmail.com>,
	 "Luke D. Jones" <luke@ljones.dev>,
	Hans de Goede <hdegoede@redhat.com>,
	 platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	 lvc-project@linuxtesting.org, stable@vger.kernel.org
Subject: Re: [PATCH] asus-laptop: Fix an uninitialized variable
Date: Tue, 25 Mar 2025 13:18:08 +0200 (EET)	[thread overview]
Message-ID: <88f06d15-0f98-2f24-7e68-eefb6434f108@linux.intel.com> (raw)
In-Reply-To: <20250325095739.20310-1-arefev@swemel.ru>

On Tue, 25 Mar 2025, Denis Arefev wrote:

> The value returned by the acpi_evaluate_integer() function is not
> checked, but the result is not always successful, so an uninitialized
> 'val' variable may be used in calculations.
> 
> 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 <arefev@swemel.ru>
> ---
>  drivers/platform/x86/asus-laptop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
> index d460dd194f19..b74b7d0eb6c2 100644
> --- a/drivers/platform/x86/asus-laptop.c
> +++ b/drivers/platform/x86/asus-laptop.c
> @@ -427,7 +427,7 @@ static int asus_pega_lucid_set(struct asus_laptop *asus, int unit, bool enable)
>  static int pega_acc_axis(struct asus_laptop *asus, int curr, char *method)
>  {
>  	int i, delta;
> -	unsigned long long val;
> +	unsigned long long val = PEGA_ACC_CLAMP;
>  	for (i = 0; i < PEGA_ACC_RETRIES; i++) {
>  		acpi_evaluate_integer(asus->handle, method, NULL, &val);

Shouldn't you handle the error from acpi_evaluate_integer() properly 
instead?

-- 
 i.


  reply	other threads:[~2025-03-25 11:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25  9:57 [PATCH] asus-laptop: Fix an uninitialized variable Denis Arefev
2025-03-25 11:18 ` Ilpo Järvinen [this message]
2025-03-26 12:07   ` Arefev
2025-03-28 13:53     ` Ilpo Järvinen
2025-04-03 12:23       ` Denis Arefev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=88f06d15-0f98-2f24-7e68-eefb6434f108@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=arefev@swemel.ru \
    --cc=corentin.chary@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --cc=lvc-project@linuxtesting.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox