[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e597d6b8-55d6-2fa6-5f79-86ff813d8bd2@pmhahn.de>
Date: Tue, 13 Jul 2021 08:02:26 +0200
From: Philipp Hahn <pmhahn@...ahn.de>
To: Salah Triki <salah.triki@...il.com>, fabrice.gasnier@...s.st.com,
thierry.reding@...il.com, u.kleine-koenig@...gutronix.de,
lee.jones@...aro.org, mcoquelin.stm32@...il.com,
alexandre.torgue@...s.st.com
Cc: linux-pwm@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] divide by 3*sizeof(u32) when computing array_size
Hello,
Disclaimer: I have no idea what 'pwm-stm32' is or does
Am 13.07.21 um 01:19 schrieb Salah Triki:
> Divide by 3*sizeof(u32) when computing array_size, since stm32_breakinput
> has 3 fields of type u32.
...
> --- a/drivers/pwm/pwm-stm32.c
> +++ b/drivers/pwm/pwm-stm32.c
> @@ -544,7 +544,7 @@ static int stm32_pwm_probe_breakinputs(struct stm32_pwm *priv,
> return -EINVAL;
>
> priv->num_breakinputs = nb;
> - array_size = nb * sizeof(struct stm32_breakinput) / sizeof(u32);
> + array_size = nb * sizeof(struct stm32_breakinput) / (3 * sizeof(u32));
Maybe it's too early in the morning for me, but this does not look right:
> struct stm32_breakinput {
> u32 index;
> u32 level;
> u32 filter;
> };
then "sizeof(struct stm32_breakinput)" == "(3 * sizeof(u32))", which
would simply make "arrray_site := nb" ?
Philipp
Powered by blists - more mailing lists