ALSA: usb-audio: Fix invalid use of sizeof in parse_uac_endpoint_attributes()
authorWei Yongjun <weiyongjun1@huawei.com>
Thu, 2 Aug 2018 04:31:02 +0000 (04:31 +0000)
committerTakashi Iwai <tiwai@suse.de>
Thu, 2 Aug 2018 05:26:37 +0000 (07:26 +0200)
sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Fixes: 7edf3b5e6a45 ("ALSA: usb-audio: AudioStreaming Power Domain parsing")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/stream.c

index 8fe3b0e00e45360c8300085e7046b88877e02688..67cf849aa16b9ef25ab519cfa0ce4dc7aaaed505 100644 (file)
@@ -1037,7 +1037,7 @@ found_clock:
                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);