Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp663974imu; Tue, 27 Nov 2018 04:37:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/VLB9AWkZoDZ0b/LXwHdePPUxy8TSv35OBOaNRq0BNTXDN3wEy+WxUjhWVUI0t5wKTQgJL8 X-Received: by 2002:a17:902:103:: with SMTP id 3-v6mr30941448plb.87.1543322251742; Tue, 27 Nov 2018 04:37:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543322251; cv=none; d=google.com; s=arc-20160816; b=jUhumySiVo3XtxoNoBJMzUBF962vYGfonjZbk1Ftdj2UcPl8sMO8ToVJjqa+4B1L6/ jryz8QzsniR1QiG/ScOCwgQnkhxeaFrVZ5Mc/hzqWxznEX7HykELUQmrJdV7r9/zJ0bE ZXrPe0HR1zQ5QxW+N/fDQBTN+3HOjyVLyXFX2CULuNOsIa2ggpoDB2ivn/IeKhsQ6dzU fICLfWWfaqu1cELytXlI5lEt3/uv4L6/sfLszrFGR3Jw85/8f1tGhUgieCFLUj7FGw7+ w6vyYBreNJRFP31O9b/vT6J0P/lpmYxmcVTQcxZEnhbM2kMmHs1fRjg2qCX/Me3cf2OB +ApQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GxJjKT2oScSrKEokEtf+IwLLCDatpwMfk2CPUmI+bbQ=; b=lVeYoo9fXHAvdm1NqX4lgb6sf8+ehBmmvbqx79rDM/+56NHzzejuVJsIJRcrh/4L80 qseOH60nGUn08rePeroCthCWIle16UnkZEA5P6GANg0BfI25BkPc2Zwehx0f/WGXm8Kn 5kfa/RiSjGx2ibD+LOt3lNVBNyTgQrRneOavJLrYdoCCi3tO80YgvZvp8O8SXJFD9fdE M7jacGatP7aFelSxrNVb0/UPH58SnJ66Ed/hRhz8nqs4AvYcxG26JA9cNt9C0td9HYUv OgnNm7ZbbHPETzoS4KDXUo0pDdhOrRK2ee+1bclmVMI5fbIamTQ0GkIQ4PzeW0iAqS7D MPVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 19si3615824pgp.186.2018.11.27.04.37.08; Tue, 27 Nov 2018 04:37:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729207AbeK0Xd3 (ORCPT + 99 others); Tue, 27 Nov 2018 18:33:29 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:11974 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726407AbeK0Xd3 (ORCPT ); Tue, 27 Nov 2018 18:33:29 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 066CBB2F2355EC6B8623; Tue, 27 Nov 2018 20:35:39 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wARCZOPk078759; Tue, 27 Nov 2018 20:35:24 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from LIN-A6CB96A0603.zte.intra ([10.90.106.118]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112720354038-13299299 ; Tue, 27 Nov 2018 20:35:40 +0800 From: Wen Yang 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 , Liam Girdwood , Jaroslav Kysela , Alexandre Torgue , Julia Lawall , Wen Yang , 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 Message-Id: <20181127123520.44940-1-wen.yang99@zte.com.cn> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-27 20:35:40, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-27 20:35:19 Content-Transfer-Encoding: quoted-printable X-MAIL: mse01.zte.com.cn wARCZOPk078759 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 CC: Olivier Moysan CC: Arnaud Pouliquen CC: Liam Girdwood CC: Jaroslav Kysela CC: Takashi Iwai CC: Maxime Coquelin CC: Alexandre Torgue CC: Julia Lawall CC: Wen Yang CC: linux-stm32@st-md-mailman.stormreply.com CC: linux-kernel@vger.kernel.org --- sound/soc/stm/stm32=5Fsai=5Fsub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/stm/stm32=5Fsai=5Fsub.c b/sound/soc/stm/stm32=5Fsai= =5Fsub.c index ea05cc91aa05..211589b0b2ef 100644 --- a/sound/soc/stm/stm32=5Fsai=5Fsub.c +++ b/sound/soc/stm/stm32=5Fsai=5Fsub.c @@ -390,7 +390,7 @@ static int stm32=5Fsai=5Fadd=5Fmclk=5Fprovider(struct s= tm32=5Fsai=5Fsub=5Fdata *sai) char *mclk=5Fname, *p, *s =3D (char *)pname; int ret, i =3D 0; =20 - mclk =3D devm=5Fkzalloc(dev, sizeof(mclk), GFP=5FKERNEL); + mclk =3D devm=5Fkzalloc(dev, sizeof(*mclk), GFP=5FKERNEL); if (!mclk) return -ENOMEM; =20 --=20 2.19.1