From patchwork Tue Jan 17 11:15:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alexey V. Vissarionov" X-Patchwork-Id: 13104917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A805DC6379F for ; Tue, 17 Jan 2023 17:13:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8BBA06B11; Tue, 17 Jan 2023 18:12:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8BBA06B11 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673975616; bh=T1YX+7v++iT+p9UCqcNeNXf8qzxAO8KXpTdkm/5Wh/4=; h=Date:From:To:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=nVGB29nK8LuHvAKzsMfNvHIAacUFmyLfgOw7LKUhRzRyYp9qizZRcJiorfM91zb4b m68ensm0paMUxN/OY2GsnsZ7+818Q+DnyvyV1Y2Buv2yIxreucuwjbU2mmAN1mJVpk VjcbcZJQrESnyaAtuciD9O/EYZ5mx/69Y3OiapMk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9E74AF8053C; Tue, 17 Jan 2023 18:12:41 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D4839F8047B; Tue, 17 Jan 2023 12:15:30 +0100 (CET) Received: from air.basealt.ru (air.basealt.ru [194.107.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 34575F8022D for ; Tue, 17 Jan 2023 12:15:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 34575F8022D Received: by air.basealt.ru (Postfix, from userid 490) id 8FCFE2F20230; Tue, 17 Jan 2023 11:15:25 +0000 (UTC) Received: from localhost (broadband-188-32-10-232.ip.moscow.rt.ru [188.32.10.232]) by air.basealt.ru (Postfix) with ESMTPSA id 1D6B82F2022C; Tue, 17 Jan 2023 11:15:23 +0000 (UTC) Date: Tue, 17 Jan 2023 14:15:23 +0300 From: "Alexey V. Vissarionov" To: Jaroslav Kysela Subject: [PATCH] ALSA: hda/ca0132: minor fix for allocation size Message-ID: <20230117111522.GA15213@altlinux.org> MIME-Version: 1.0 Content-Disposition: inline X-Mailman-Approved-At: Tue, 17 Jan 2023 18:12:39 +0100 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: alsa-devel@alsa-project.org, lvc-project@linuxtesting.org, Ian Minett , ye xingchen , Takashi Iwai , Xian Wang , "Alexey V. Vissarionov" Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Although the "dma_chan" pointer occupies more or equal space compared to "*dma_chan", the allocation size should use the size of variable itself. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 01ef7dbffb411d9d ("ALSA: hda - Update CA0132 codec to load DSP firmware binary") Signed-off-by: Alexey V. Vissarionov diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 0a292bf271f2e59a..acde4cd58785e0cb 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -2455,7 +2455,7 @@ static int dspio_set_uint_param(struct hda_codec *codec, int mod_id, static int dspio_alloc_dma_chan(struct hda_codec *codec, unsigned int *dma_chan) { int status = 0; - unsigned int size = sizeof(dma_chan); + unsigned int size = sizeof(*dma_chan); codec_dbg(codec, " dspio_alloc_dma_chan() -- begin\n"); status = dspio_scp(codec, MASTERCONTROL, 0x20,