linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] divide by 3*sizeof(u32) when computing array_size
@ 2021-07-12 23:19 Salah Triki
  2021-07-13  6:02 ` Philipp Hahn
  2021-07-13  6:30 ` Uwe Kleine-König
  0 siblings, 2 replies; 9+ messages in thread
From: Salah Triki @ 2021-07-12 23:19 UTC (permalink / raw)
  To: fabrice.gasnier, thierry.reding, u.kleine-koenig, lee.jones,
	mcoquelin.stm32, alexandre.torgue
  Cc: linux-pwm, linux-stm32, linux-arm-kernel, linux-kernel

Divide by 3*sizeof(u32) when computing array_size, since stm32_breakinput
has 3 fields of type u32.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/pwm/pwm-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 794ca5b02968..fb21bc2b2dd6 100644
--- 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));
 	ret = of_property_read_u32_array(np, "st,breakinput",
 					 (u32 *)priv->breakinputs, array_size);
 	if (ret)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-07-13 12:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 23:19 [PATCH] divide by 3*sizeof(u32) when computing array_size Salah Triki
2021-07-13  6:02 ` Philipp Hahn
2021-07-13  6:30 ` Uwe Kleine-König
2021-07-13  9:07   ` Uwe Kleine-König
2021-07-13  9:19   ` Russell King (Oracle)
2021-07-13 11:07     ` David Laight
2021-07-13 11:22       ` Russell King (Oracle)
2021-07-13 12:20         ` David Laight
2021-07-13 12:35           ` Russell King (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).