mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wen Yang <wen.yang99@zte.com.cn>
To: olivier.moysan@st.com, arnaud.pouliquen@st.com,
	broonie@kernel.org, tiwai@suse.com, mcoquelin.stm32@gmail.com
Cc: linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn,
	Wen Yang <wen.yang99@zte.com.cn>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Julia Lawall <julia.lawall@lip6.fr>,
	Wen Yang <yellowriver2010@hotmail.com>,
	linux-stm32@st-md-mailman.stormreply.com
Subject: [PATCH] Fix invalid use of sizeof in stm32_sai_add_mclk_provider()
Date: Tue, 27 Nov 2018 20:35:20 +0800	[thread overview]
Message-ID: <20181127123520.44940-1-wen.yang99@zte.com.cn> (raw)

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.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
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


             reply	other threads:[~2018-11-27 12:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27 12:35 Wen Yang [this message]
2018-11-28 12:38 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181127123520.44940-1-wen.yang99@zte.com.cn \
    --to=wen.yang99@zte.com.cn \
    --cc=alexandre.torgue@st.com \
    --cc=arnaud.pouliquen@st.com \
    --cc=broonie@kernel.org \
    --cc=julia.lawall@lip6.fr \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=olivier.moysan@st.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=yellowriver2010@hotmail.com \
    --cc=zhong.weidong@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®