From patchwork Sat Aug 12 15:34:38 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: 9897375 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 206B560325 for ; Sat, 12 Aug 2017 15:38:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10F9B287C0 for ; Sat, 12 Aug 2017 15:38:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0597728A0A; Sat, 12 Aug 2017 15:38:05 +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=unavailable 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 071F2287C0 for ; Sat, 12 Aug 2017 15:38:04 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B7A7A26702D; Sat, 12 Aug 2017 17:36: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 0E26226702D; Sat, 12 Aug 2017 17:36:06 +0200 (CEST) Received: from mout.web.de (mout.web.de [212.227.17.12]) by alsa0.perex.cz (Postfix) with ESMTP id 06DDF2671E4 for ; Sat, 12 Aug 2017 17:34:46 +0200 (CEST) Received: from [192.168.1.2] ([77.181.183.107]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MgwZQ-1e2dgf3sps-00M6xq; Sat, 12 Aug 2017 17:34:42 +0200 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Arnd Bergmann , Colin Ian King , Jaroslav Kysela , Julia Lawall , Takashi Iwai , Takashi Sakamoto References: Message-ID: Date: Sat, 12 Aug 2017 17:34:38 +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: Content-Language: en-GB X-Provags-ID: V03:K0:pe3QyrBlf8oY4G8BBpSrL7YbqG7dMzzIGwaqRbi4hIixKc+/f6n OoIQRXeeCTV665vL9o0BPpoOWfrcSmTRWF6M/J7eQMzfTiNMJrwP6jkP6923KIszQV7ppmL s201rsl6DrsAVBLRMa8nVT0IqF9+E48hu72hNfUzyvF38/VFHCp5sorFr1nTWT9dINZ8C5B 0oeNsp742Fuf9mVooLxsw== X-UI-Out-Filterresults: notjunk:1; V01:K0:6gNzWR4MrH0=:3t8pd51oXIoAP2G5bZWR+j pyOOEq0VXOd2cDJfkY5KiTFMPgjiKpFDlDeCjciVMER3m6o2HaKBK/yWPPuEeNOcPewyqV1qZ i5O9ER7zoz3c8DKvOHnhMK2HztLJbDQB3tk11Av1nsaysuuSuN64wyx+Qy9OUMFDoFxqIYzxj CymqOICZaaYCm3oZ481Rg1r6okH5r0qXLU5q2o1/sB1/1RW6f98LbwiAItfYeOAhyu1JvYNYj mU84hgGPmI0jWohzFVIEvcNZWNVMGzkN3bN6+PvWVHXZigph4zQQcGAqyk4rOMZSNzsksxRW7 asFpBSGHpvmDBMEzlDgb4oOPukvzf5qUySXX/nbhSVRU32GWVBkUqYsxlAls/cr1K/wK+lURP AJE6m/g2mbxyh2Lz+TtJzz1wIUVbzGdXEYFjsjdU22xrSTmMfuiOqFHJwrzbns1nZ3SBNlntn NqNkvhg/Do7ryQniy/DdhN/De1x1WO1RYSNWJ7PEFVO7J/BH/XaUPJON8lN3XSZg7pGRy9k+Z qlmMQ8eSf5/y9kCD3W3EfIIWxeKHOOkhtXLU2uYEhojt0IXqUyMHRG9vM2yLK//LPea/7FAdg W9CQW2j3xVUsy5mxfkaYDYCIHgBi9vnaTfSApqB7t78GMVczREb7uNgOOKtL6oDa9Cw266Ano pcGYs5cG46eQdVakET3nEEKyPUiwCrtmCbF7n19kgPHIvwgzBGPOjbnCriiZx2o4lnMJCToVd LilsIm67nQGmxCGY3VfmSra2qnhj9Uk7dt6TaQU02XGJaihrwVe5Mgn1qgdMvMuWns/MwBHTl 647TjPHpPH2R5CiTxD7xz/iZ2tmFo+Xy8uew6ElLPSfdfnL4fw= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 2/3] ALSA: rme9652: Improve eight size determinations 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: Sat, 12 Aug 2017 16:50:06 +0200 Replace the specification of data structures by variable references 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/pci/rme9652/hdspm.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index d448cf474c1b..8d339fb7c24b 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -6221,7 +6221,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, } levels->status2 = hdspm_read(hdspm, HDSPM_statusRegister2); - s = copy_to_user(argp, levels, sizeof(struct hdspm_peak_rms)); + s = copy_to_user(argp, levels, sizeof(*levels)); if (0 != s) { /* dev_err(hdspm->card->dev, "copy_to_user(.., .., %lu): %lu [Levels]\n", sizeof(struct hdspm_peak_rms), s); @@ -6266,7 +6266,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, ltc.input_format = no_video; } - s = copy_to_user(argp, <c, sizeof(struct hdspm_ltc)); + s = copy_to_user(argp, <c, sizeof(ltc)); if (0 != s) { /* dev_err(hdspm->card->dev, "copy_to_user(.., .., %lu): %lu [LTC]\n", sizeof(struct hdspm_ltc), s); */ @@ -6357,7 +6357,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, if (copy_from_user(&mixer, argp, sizeof(mixer))) return -EFAULT; if (copy_to_user((void __user *)mixer.mixer, hdspm->mixer, - sizeof(struct hdspm_mixer))) + sizeof(*mixer.mixer))) return -EFAULT; break; @@ -6636,8 +6636,8 @@ static int snd_hdspm_create(struct snd_card *card, hdspm->irq = pci->irq; dev_dbg(card->dev, "kmalloc Mixer memory of %zd Bytes\n", - sizeof(struct hdspm_mixer)); - hdspm->mixer = kzalloc(sizeof(struct hdspm_mixer), GFP_KERNEL); + sizeof(*hdspm->mixer)); + hdspm->mixer = kzalloc(sizeof(*hdspm->mixer), GFP_KERNEL); if (!hdspm->mixer) return -ENOMEM; @@ -6774,8 +6774,7 @@ static int snd_hdspm_create(struct snd_card *card, if (hdspm_read(hdspm, HDSPM_statusRegister2) & HDSPM_s2_tco_detect) { hdspm->midiPorts++; - hdspm->tco = kzalloc(sizeof(struct hdspm_tco), - GFP_KERNEL); + hdspm->tco = kzalloc(sizeof(*hdspm->tco), GFP_KERNEL); if (NULL != hdspm->tco) { hdspm_tco_write(hdspm); } @@ -6789,8 +6788,7 @@ static int snd_hdspm_create(struct snd_card *card, case AES32: if (hdspm_read(hdspm, HDSPM_statusRegister) & HDSPM_tco_detect) { hdspm->midiPorts++; - hdspm->tco = kzalloc(sizeof(struct hdspm_tco), - GFP_KERNEL); + hdspm->tco = kzalloc(sizeof(*hdspm->tco), GFP_KERNEL); if (NULL != hdspm->tco) { hdspm_tco_write(hdspm); } @@ -6941,7 +6939,7 @@ static int snd_hdspm_probe(struct pci_dev *pci, } err = snd_card_new(&pci->dev, index[dev], id[dev], - THIS_MODULE, sizeof(struct hdspm), &card); + THIS_MODULE, sizeof(*hdspm), &card); if (err < 0) return err;