Skip to contentSkip to conversation

ALSA: usb-audio: Fix wrong sizeof argument

PATCH In review Gustavo A. R. Silva 2 participants 3 messages Aug 2, 2018 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: Fix wrong sizeof argument

The correct argument to be passed to kzalloc is sizeof(*pd)

Addresses-Coverity-ID: 1472224 ("Wrong sizeof argument")

Fixes 7edf3b5e6a45 ("ALSA: usb-audio: AudioStreaming Power Domain parsing")
---
 sound/usb/stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/stream.c +1 -1
index 8fe3b0e..67cf849 100644
@@ -1037,7 +1037,7 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
 		fp->rate_max = UAC3_BADD_SAMPLING_RATE;
 		fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
 
-		pd = kzalloc(sizeof(pd), GFP_KERNEL);
+		pd = kzalloc(sizeof(*pd), GFP_KERNEL);
 		if (!pd) {
 			kfree(fp->rate_table);
 			kfree(fp);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 6 lines · Gustavo A. R. Silva

The correct argument to be passed to kzalloc is sizeof(*pd)

Addresses-Coverity-ID: 1472224 ("Wrong sizeof argument")

Fixes 7edf3b5e6a45 ("ALSA: usb-audio: AudioStreaming Power Domain parsing")

It's already fixed, thanks.

Takashi

#2 lore raw
Quoted 11 lines · Takashi Iwai
Quoted 6 lines · Gustavo A. R. Silva

The correct argument to be passed to kzalloc is sizeof(*pd)

Addresses-Coverity-ID: 1472224 ("Wrong sizeof argument")

Fixes 7edf3b5e6a45 ("ALSA: usb-audio: AudioStreaming Power Domain parsing")

It's already fixed, thanks.

Good to know. :)

Thanks
--
Gustavo