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: <20210521182602.GM28060@e120937-lin>
Date:   Fri, 21 May 2021 19:26:02 +0100
From:   Cristian Marussi <cristian.marussi@....com>
To:     Axel Lin <axel.lin@...ics.com>
Cc:     Mark Brown <broonie@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] regulator: scmi: Fix off-by-one for linear regulators
 .n_voltages setting

Hi,

On Fri, May 21, 2021 at 03:30:20PM +0800, Axel Lin wrote:
> For linear regulators, the .n_voltages is (max_uv - min_uv) / uv_step + 1.
> 
> Fixes: 0fbeae70ee7c ("regulator: add SCMI driver")
> Signed-off-by: Axel Lin <axel.lin@...ics.com>
> ---

Right. Good catch.

Reviewed-by: Cristian Marussi <cristian.marussi@....com>

Thanks,
Cristian

>  drivers/regulator/scmi-regulator.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c
> index bbadf72b94e8..1f02f60ad136 100644
> --- a/drivers/regulator/scmi-regulator.c
> +++ b/drivers/regulator/scmi-regulator.c
> @@ -173,7 +173,7 @@ scmi_config_linear_regulator_mappings(struct scmi_regulator *sreg,
>  		sreg->desc.uV_step =
>  			vinfo->levels_uv[SCMI_VOLTAGE_SEGMENT_STEP];
>  		sreg->desc.linear_min_sel = 0;
> -		sreg->desc.n_voltages = delta_uV / sreg->desc.uV_step;
> +		sreg->desc.n_voltages = (delta_uV / sreg->desc.uV_step) + 1;
>  		sreg->desc.ops = &scmi_reg_linear_ops;
>  	}
>  
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ