lkml.org 
[lkml]   [2021]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] divide by 3*sizeof(u32) when computing array_size
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
\
 
 \ /
  Last update: 2021-07-13 01:20    [W:0.051 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site