ALSA: hda/ca0132: minor fix for allocation size
authorAlexey V. Vissarionov <gremlin@altlinux.org>
Tue, 17 Jan 2023 11:15:23 +0000 (14:15 +0300)
committerTakashi Iwai <tiwai@suse.de>
Tue, 17 Jan 2023 17:01:34 +0000 (18:01 +0100)
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: 01ef7dbffb41 ("ALSA: hda - Update CA0132 codec to load DSP firmware binary")
Signed-off-by: Alexey V. Vissarionov <gremlin@altlinux.org>
Link: https://lore.kernel.org/r/20230117111522.GA15213@altlinux.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_ca0132.c

index 0a292bf271f2e59a66124acf4c97c5d19ab86d22..acde4cd58785e0cbaa8196bbacead97826e822ac 100644 (file)
@@ -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,