[PATCH v2] ASoC: stm32: sai: Fix invalid use of sizeof in stm32_sai_add_mclk_provider()
From: Wen Yang
Date: Wed Nov 28 2018 - 20:44:49 EST
sizeof(mclk) is 4 or 8 as it is the size of a pointer,
but we want to reserve space for the pointed data.
This issue was detected by using the Coccinelle software.
v2: use subject lines matching the style for the subsystem.
Signed-off-by: Wen Yang <wen.yang99@xxxxxxxxxx>
CC: Mark Brown <broonie@xxxxxxxxxx>
CC: Olivier Moysan <olivier.moysan@xxxxxx>
CC: Arnaud Pouliquen <arnaud.pouliquen@xxxxxx>
CC: Liam Girdwood <lgirdwood@xxxxxxxxx>
CC: Jaroslav Kysela <perex@xxxxxxxx>
CC: Takashi Iwai <tiwai@xxxxxxxx>
CC: Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>
CC: Alexandre Torgue <alexandre.torgue@xxxxxx>
CC: Julia Lawall <julia.lawall@xxxxxxx>
CC: Wen Yang <yellowriver2010@xxxxxxxxxxx>
CC: linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
---
sound/soc/stm/stm32_sai_sub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index ea05cc91aa05..211589b0b2ef 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -390,7 +390,7 @@ static int stm32_sai_add_mclk_provider(struct stm32_sai_sub_data *sai)
char *mclk_name, *p, *s = (char *)pname;
int ret, i = 0;
- mclk = devm_kzalloc(dev, sizeof(mclk), GFP_KERNEL);
+ mclk = devm_kzalloc(dev, sizeof(*mclk), GFP_KERNEL);
if (!mclk)
return -ENOMEM;
--
2.19.1