aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/midi_synth.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-27 20:35:07 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-27 20:35:07 -0700
commit7b724a2260731edbddadfa08f13de5bce2e601a2 (patch)
treedcf905f023635ee22aacd917d2a2706f257ee7eb /sound/oss/midi_synth.c
parent551b0bda46d4caf74755a018e2cdb1d093e000c9 (diff)
parenta45e3d6b13e97506b616980c0f122c3389bcefa4 (diff)
downloadkernel_samsung_smdk4412-7b724a2260731edbddadfa08f13de5bce2e601a2.tar.gz
kernel_samsung_smdk4412-7b724a2260731edbddadfa08f13de5bce2e601a2.tar.bz2
kernel_samsung_smdk4412-7b724a2260731edbddadfa08f13de5bce2e601a2.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: ALSA: Fix yet another race in disconnection ALSA: asihpi - Update verbose debug print macros ALSA: asihpi - Improve non-busmaster adapter operation ALSA: asihpi - Support single-rate no-SRC cards ALSA: HDA: New AD1984A model for Dell Precision R5500 ALSA: vmalloc buffers should use normal mmap ALSA: hda - Fix SPDIF out regression on ALC889 ALSA: usb-audio - Support for Boss JS-8 Jam Station ALSA: usb-audio: add Cakewalk UM-1G support sound/oss/opl3: validate voice and channel indexes sound/oss: remove offset from load_patch callbacks
Diffstat (limited to 'sound/oss/midi_synth.c')
-rw-r--r--sound/oss/midi_synth.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/sound/oss/midi_synth.c b/sound/oss/midi_synth.c
index 3c09374ea5b..2292c230d7e 100644
--- a/sound/oss/midi_synth.c
+++ b/sound/oss/midi_synth.c
@@ -476,7 +476,7 @@ EXPORT_SYMBOL(midi_synth_hw_control);
int
midi_synth_load_patch(int dev, int format, const char __user *addr,
- int offs, int count, int pmgr_flag)
+ int count, int pmgr_flag)
{
int orig_dev = synth_devs[dev]->midi_dev;
@@ -491,33 +491,29 @@ midi_synth_load_patch(int dev, int format, const char __user *addr,
if (!prefix_cmd(orig_dev, 0xf0))
return 0;
+ /* Invalid patch format */
if (format != SYSEX_PATCH)
- {
-/* printk("MIDI Error: Invalid patch format (key) 0x%x\n", format);*/
return -EINVAL;
- }
+
+ /* Patch header too short */
if (count < hdr_size)
- {
-/* printk("MIDI Error: Patch header too short\n");*/
return -EINVAL;
- }
+
count -= hdr_size;
/*
- * Copy the header from user space but ignore the first bytes which have
- * been transferred already.
+ * Copy the header from user space
*/
- if(copy_from_user(&((char *) &sysex)[offs], &(addr)[offs], hdr_size - offs))
+ if (copy_from_user(&sysex, addr, hdr_size))
return -EFAULT;
-
- if (count < sysex.len)
- {
-/* printk(KERN_WARNING "MIDI Warning: Sysex record too short (%d<%d)\n", count, (int) sysex.len);*/
+
+ /* Sysex record too short */
+ if ((unsigned)count < (unsigned)sysex.len)
sysex.len = count;
- }
- left = sysex.len;
- src_offs = 0;
+
+ left = sysex.len;
+ src_offs = 0;
for (i = 0; i < left && !signal_pending(current); i++)
{