From: Armin Wolf <W_Armin@gmx.de>
To: "Dmitry Antipov" <dmantipov@yandex.ru>,
"Lee Chun-Yi" <jlee@suse.com>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org, lvc-project@linuxtesting.org
Subject: Re: [PATCH] platform/x86: acer-wmi: fix fan mode setup in WMID_gaming_set_fan_mode()
Date: Tue, 17 Dec 2024 01:50:05 +0100 [thread overview]
Message-ID: <f3752e1c-0702-433a-b358-c3e89968f6ae@gmx.de> (raw)
In-Reply-To: <20241216132400.302003-1-dmantipov@yandex.ru>
Am 16.12.24 um 14:24 schrieb Dmitry Antipov:
> In 'WMID_gaming_set_fan_mode()', most likely the (whether CPU or
> GPU or even total) fan count is not larger than 31. But still
> cast everyting to 'u64' just to be sure that there is no integer
> overflow when performing left shifts. Compile tested only.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
> drivers/platform/x86/acer-wmi.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index d09baa3d3d90..9be6176c0076 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -1504,17 +1504,17 @@ static void WMID_gaming_set_fan_mode(u8 fan_mode)
> int i;
>
> if (quirks->cpu_fans > 0)
> - gpu_fan_config2 |= 1;
> + gpu_fan_config2 |= 1ULL;
> for (i = 0; i < (quirks->cpu_fans + quirks->gpu_fans); ++i)
> - gpu_fan_config2 |= 1 << (i + 1);
> + gpu_fan_config2 |= 1ULL << (i + 1);
> for (i = 0; i < quirks->gpu_fans; ++i)
> - gpu_fan_config2 |= 1 << (i + 3);
> + gpu_fan_config2 |= 1ULL << (i + 3);
> if (quirks->cpu_fans > 0)
> gpu_fan_config1 |= fan_mode;
> for (i = 0; i < (quirks->cpu_fans + quirks->gpu_fans); ++i)
> - gpu_fan_config1 |= fan_mode << (2 * i + 2);
> + gpu_fan_config1 |= (u64)fan_mode << (2 * i + 2);
> for (i = 0; i < quirks->gpu_fans; ++i)
> - gpu_fan_config1 |= fan_mode << (2 * i + 6);
> + gpu_fan_config1 |= (u64)fan_mode << (2 * i + 6);
> WMID_gaming_set_u64(gpu_fan_config2 | gpu_fan_config1 << 16, ACER_CAP_TURBO_FAN);
> }
>
next prev parent reply other threads:[~2024-12-17 0:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-16 13:24 [PATCH] platform/x86: acer-wmi: fix fan mode setup in WMID_gaming_set_fan_mode() Dmitry Antipov
2024-12-17 0:50 ` Armin Wolf [this message]
2024-12-17 14:47 ` Ilpo Järvinen
2024-12-19 11:25 ` [lvc-project] " Antipov, Dmitriy
2024-12-19 12:08 ` Ilpo Järvinen
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=f3752e1c-0702-433a-b358-c3e89968f6ae@gmx.de \
--to=w_armin@gmx.de \
--cc=dmantipov@yandex.ru \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jlee@suse.com \
--cc=lvc-project@linuxtesting.org \
--cc=platform-driver-x86@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