diff options
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r-- | sound/usb/usbaudio.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 49248fa7aef4..a42acf6d7b68 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2046,10 +2046,9 @@ int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, | |||
2046 | void *buf = NULL; | 2046 | void *buf = NULL; |
2047 | 2047 | ||
2048 | if (size > 0) { | 2048 | if (size > 0) { |
2049 | buf = kmalloc(size, GFP_KERNEL); | 2049 | buf = kmemdup(data, size, GFP_KERNEL); |
2050 | if (!buf) | 2050 | if (!buf) |
2051 | return -ENOMEM; | 2051 | return -ENOMEM; |
2052 | memcpy(buf, data, size); | ||
2053 | } | 2052 | } |
2054 | err = usb_control_msg(dev, pipe, request, requesttype, | 2053 | err = usb_control_msg(dev, pipe, request, requesttype, |
2055 | value, index, buf, size, timeout); | 2054 | value, index, buf, size, timeout); |
@@ -2846,12 +2845,11 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, | |||
2846 | int stream, err; | 2845 | int stream, err; |
2847 | int *rate_table = NULL; | 2846 | int *rate_table = NULL; |
2848 | 2847 | ||
2849 | fp = kmalloc(sizeof(*fp), GFP_KERNEL); | 2848 | fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL); |
2850 | if (! fp) { | 2849 | if (! fp) { |
2851 | snd_printk(KERN_ERR "cannot malloc\n"); | 2850 | snd_printk(KERN_ERR "cannot memdup\n"); |
2852 | return -ENOMEM; | 2851 | return -ENOMEM; |
2853 | } | 2852 | } |
2854 | memcpy(fp, quirk->data, sizeof(*fp)); | ||
2855 | if (fp->nr_rates > 0) { | 2853 | if (fp->nr_rates > 0) { |
2856 | rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL); | 2854 | rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL); |
2857 | if (!rate_table) { | 2855 | if (!rate_table) { |
@@ -3029,10 +3027,9 @@ static int create_ua1000_quirk(struct snd_usb_audio *chip, | |||
3029 | altsd->bNumEndpoints != 1) | 3027 | altsd->bNumEndpoints != 1) |
3030 | return -ENXIO; | 3028 | return -ENXIO; |
3031 | 3029 | ||
3032 | fp = kmalloc(sizeof(*fp), GFP_KERNEL); | 3030 | fp = kmemdup(&ua1000_format, sizeof(*fp), GFP_KERNEL); |
3033 | if (!fp) | 3031 | if (!fp) |
3034 | return -ENOMEM; | 3032 | return -ENOMEM; |
3035 | memcpy(fp, &ua1000_format, sizeof(*fp)); | ||
3036 | 3033 | ||
3037 | fp->channels = alts->extra[4]; | 3034 | fp->channels = alts->extra[4]; |
3038 | fp->iface = altsd->bInterfaceNumber; | 3035 | fp->iface = altsd->bInterfaceNumber; |