ALSA: usb-audio: Fix wrong sizeof argument
diff mbox series

Message ID 20180802141723.GA7258@embeddedor.com
State New
Headers show
Series
  • ALSA: usb-audio: Fix wrong sizeof argument
Related show

Commit Message

Gustavo A. R. Silva Aug. 2, 2018, 2:17 p.m. UTC
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")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 sound/usb/stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Takashi Iwai Aug. 2, 2018, 2:20 p.m. UTC | #1
On Thu, 02 Aug 2018 16:17:23 +0200,
 Gustavo A. R. Silva  wrote:
> 
> 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")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

It's already fixed, thanks.


Takashi
Gustavo A. R. Silva Aug. 2, 2018, 7:54 p.m. UTC | #2
On 08/02/2018 09:20 AM, Takashi Iwai wrote:
> On Thu, 02 Aug 2018 16:17:23 +0200,
>  Gustavo A. R. Silva  wrote:
>>
>> 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")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> 
> It's already fixed, thanks.
> 

Good to know. :)

Thanks
--
Gustavo

Patch
diff mbox series

diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 8fe3b0e..67cf849 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -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);