All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: stm32: sai: Fix invalid use of sizeof in stm32_sai_add_mclk_provider()
@ 2018-11-29  1:44 Wen Yang
  0 siblings, 0 replies; only message in thread
From: Wen Yang @ 2018-11-29  1:44 UTC (permalink / raw)
  To: olivier.moysan, arnaud.pouliquen, broonie, tiwai, mcoquelin.stm32
  Cc: linux-kernel, zhong.weidong, Wen Yang, Liam Girdwood,
	Jaroslav Kysela, Alexandre Torgue, Julia Lawall, Wen Yang,
	linux-stm32

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@zte.com.cn>
CC: Mark Brown <broonie@kernel.org>
CC: Olivier Moysan <olivier.moysan@st.com>
CC: Arnaud Pouliquen <arnaud.pouliquen@st.com>
CC: Liam Girdwood <lgirdwood@gmail.com>
CC: Jaroslav Kysela <perex@perex.cz>
CC: Takashi Iwai <tiwai@suse.com>
CC: Maxime Coquelin <mcoquelin.stm32@gmail.com>
CC: Alexandre Torgue <alexandre.torgue@st.com>
CC: Julia Lawall <julia.lawall@lip6.fr>
CC: Wen Yang <yellowriver2010@hotmail.com>
CC: linux-stm32@st-md-mailman.stormreply.com
CC: linux-kernel@vger.kernel.org
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-11-29  1:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29  1:44 [PATCH v2] ASoC: stm32: sai: Fix invalid use of sizeof in stm32_sai_add_mclk_provider() Wen Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.