From patchwork Wed Aug 9 08:02:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9889799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BA30602D7 for ; Wed, 9 Aug 2017 08:03:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DF1D285FC for ; Wed, 9 Aug 2017 08:03:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02AF028A1B; Wed, 9 Aug 2017 08:03:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 860C1285FC for ; Wed, 9 Aug 2017 08:03:08 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2DC632673EA; Wed, 9 Aug 2017 10:03:07 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E3A3B2673EC; Wed, 9 Aug 2017 10:03:05 +0200 (CEST) Received: from mout.web.de (mout.web.de [212.227.17.11]) by alsa0.perex.cz (Postfix) with ESMTP id 3E3E02673DD for ; Wed, 9 Aug 2017 10:03:04 +0200 (CEST) Received: from [192.168.1.2] ([77.182.172.151]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MEmgA-1dprfF1ayg-00G2im; Wed, 09 Aug 2017 10:02:59 +0200 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Jaroslav Kysela , Kees Cook , Takashi Iwai , Takashi Sakamoto References: <412aa3a5-c8b6-c1fe-febb-0d62927dacc2@users.sourceforge.net> Message-ID: <3354241b-cb2e-3d91-5dca-5e3ea427ee03@users.sourceforge.net> Date: Wed, 9 Aug 2017 10:02:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <412aa3a5-c8b6-c1fe-febb-0d62927dacc2@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:IuR5mqTYnGG1L3z4Npg6mDP6f017ZMHGt8q5rzP6mCRb6g+vE7N aKY4uAp4/yK0jKYW92VL/8jjHIX8xRgkqGZU4dznvOa9glNeJ2jNPiWptnCIm4nNqc+R8IE rj9B1WNO+eo0Eit3npneJglEGf1cxuytLLcChxm3gLd+NHJ/zOzoTq4yNJYf7+bBmyUZHLF yNyjDUGt7I0K/qJj4zsVA== X-UI-Out-Filterresults: notjunk:1; V01:K0:4qRqtDHdcQ8=:dn2SLLuUCSyNrVS3wwTyOa I6+kPKmge5hKrBsve9frRs2mvMiFT6g2Oul+zhLGVNw3XogJbA7Sn2zIQBbv724JbGtCeYbAM lES3sPcVBr/0nf0ywqLMbPA39iQzD/1AVXtgLfhTdZE7GEBRpx+u+qlMQzJm0AUHMKPateWFF 1R2YFmxnJuBlBRxT0wPefHb+LGDOPlywSkt2w1psjV87XvXPlc6jr1q9F8j5CUOSQk2LFURk3 8q4NXF/CVDrFhmp3aBRmMoK+dIoxR5toqB9JjJef3NCpTzkIDoDLpycoch04Jr8a+kPJD0lnu sa3Kd6h9NFpGr/n3FaI5CS0Uctx2Uwer6+W+xKC7KrZwkCbQEK9dUt8PMDwZPeGtgbPKeTekN dFRy+42zNOeUfoN1B2stL2/6YdHdVtaqQI0jd4trq/ha5ML/QwZPYtxPhztISXiUfaO6X3apP FqzEXzSGYGcQ1FCJfsGAuVUEDMKwnWEZsuGxdcs/z+A2QFOPb44RwNEpN8x1tn0lQmvG22zac YB+WzoiFZX8LhmU5Ex6yjR6Nt1c+U+fgNum2pmGMNphmv5ud4rUNZkvSmt1Nx0EwTOsCRrx26 /vu2HEjYdPwmsYhV1who8+G0HebovTOdJmrM4ulgpl3+rjUaJmqd4oPaSeY+Je1Y9ijQeQVzJ yewUFp9mwKFCtThaFLDDkpbEzY9ZENpOr9b79DwOGVuNPDMEFUlGJb5rI4jhFn2cCBMND8AYo jSHnx97dbWAYgsVingw9TJ6OsbvQ7Nsy7Doc7e+crAsGbT1vAeiz7yFA7GwBV759BfKqVFLpc iUhjnSCRQTVUF0P0o8YsXeP480GZqp8odQHp6ZWY4duaz8dHk4= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 2/4] ALSA: emux: Improve a size determination in two functions X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 9 Aug 2017 09:11:26 +0200 Replace the specification of data types by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- sound/synth/emux/emux_seq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c index 53820f75ba3e..12acf18c5be4 100644 --- a/sound/synth/emux/emux_seq.c +++ b/sound/synth/emux/emux_seq.c @@ -149,7 +149,8 @@ snd_emux_create_port(struct snd_emux *emu, char *name, snd_printk(KERN_ERR "no memory\n"); return NULL; } - p->chset.channels = kcalloc(max_channels, sizeof(struct snd_midi_channel), GFP_KERNEL); + p->chset.channels = kcalloc(max_channels, sizeof(*p->chset.channels), + GFP_KERNEL); if (p->chset.channels == NULL) { snd_printk(KERN_ERR "no memory\n"); kfree(p); @@ -371,7 +372,7 @@ int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card) if (emu->midi_ports <= 0) return 0; - emu->vmidi = kcalloc(emu->midi_ports, sizeof(struct snd_rawmidi *), GFP_KERNEL); + emu->vmidi = kcalloc(emu->midi_ports, sizeof(*emu->vmidi), GFP_KERNEL); if (emu->vmidi == NULL) return -ENOMEM;