Skip to contentSkip to conversation

ALSA: hda/ca0132: minor fix for allocation size

PATCH Applied Alexey V. Vissarionov 2 participants 2 messages Jan 17, 2023 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda/ca0132: minor fix for allocation size

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")
sound/pci/hda/patch_ca0132.c +1 -1
index 0a292bf271f2e59a..acde4cd58785e0cb 100644
@@ -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,
Signature · 3 lines
Alexey V. Vissarionov
gremlin ПРИ altlinux ТЧК org; +vii-cmiii-ccxxix-lxxix-xlii
GPG: 0D92F19E1C0DC36E27F61A29CD17E2B43D879005 @ hkp://keys.gnupg.net
Applied
#1 lore raw
Quoted 9 lines · Alexey V. Vissarionov

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")

Thanks, applied now.

(BTW, the Fixes tag should have the commit ID in 12 chars. I corrected locally.)

Takashi