lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gmmyLMWwzn8q_DCrKVg6mNJ+mHFcLt2AY8LJJ_4dt7dg@mail.gmail.com>
Date:   Fri, 16 Jun 2023 19:43:50 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     YiMing Tseng <yimingtseng@...gle.com>,
        Ulf Hansson <ulf.hansson@...aro.org>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Kevin Hilman <khilman@...nel.org>,
        Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        marscheng@...gle.com
Subject: Re: [PATCH] PM: domains: fix overflow in genpd_parse_state

On Tue, May 30, 2023 at 1:42 PM YiMing Tseng <yimingtseng@...gle.com> wrote:
>
> Add type casters to prevent 32-bit overflow before assigning to s64
> variables. It allows full 32-bit range support for latency and
> residency.

OK, but is it really a practical problem?

Ulf, what do you think?

> Signed-off-by: YiMing Tseng <yimingtseng@...gle.com>
> ---
>  drivers/base/power/domain.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 32084e38b73d..26a04cd8d8dc 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2939,10 +2939,10 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
>
>         err = of_property_read_u32(state_node, "min-residency-us", &residency);
>         if (!err)
> -               genpd_state->residency_ns = 1000 * residency;
> +               genpd_state->residency_ns = (s64)1000 * residency;
>
> -       genpd_state->power_on_latency_ns = 1000 * exit_latency;
> -       genpd_state->power_off_latency_ns = 1000 * entry_latency;
> +       genpd_state->power_on_latency_ns = (s64)1000 * exit_latency;
> +       genpd_state->power_off_latency_ns = (s64)1000 * entry_latency;
>         genpd_state->fwnode = &state_node->fwnode;
>
>         return 0;
> --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ