[PATCH 1/2] power: regulator: gpio-regulator: protect count value

Simon Glass sjg at chromium.org
Thu Sep 17 03:09:43 CEST 2020


On Thu, 10 Sep 2020 at 10:18, Patrick Delaunay <patrick.delaunay at st.com> wrote:
>
> Update the size of states_array to avoid overflow for
> dev_pdata->voltages[j] and dev_pdata->states[j].
>
> As the size of array is GPIO_REGULATOR_MAX_STATES, the size of
> states_array is limited by GPIO_REGULATOR_MAX_STATES * 2 = 4
> instead of 8 previously.
>
> The value of the "count" variable is limited by the third parameter of
> fdtdec_get_int_array_count.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> ---
>
>  drivers/power/regulator/gpio-regulator.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list