diff options
Diffstat (limited to 'sound/oss/opl3.c')
-rw-r--r-- | sound/oss/opl3.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c index 938c48c4358..407cd677950 100644 --- a/sound/oss/opl3.c +++ b/sound/oss/opl3.c | |||
@@ -820,7 +820,7 @@ static void opl3_hw_control(int dev, unsigned char *event) | |||
820 | } | 820 | } |
821 | 821 | ||
822 | static int opl3_load_patch(int dev, int format, const char __user *addr, | 822 | static int opl3_load_patch(int dev, int format, const char __user *addr, |
823 | int offs, int count, int pmgr_flag) | 823 | int count, int pmgr_flag) |
824 | { | 824 | { |
825 | struct sbi_instrument ins; | 825 | struct sbi_instrument ins; |
826 | 826 | ||
@@ -830,11 +830,7 @@ static int opl3_load_patch(int dev, int format, const char __user *addr, | |||
830 | return -EINVAL; | 830 | return -EINVAL; |
831 | } | 831 | } |
832 | 832 | ||
833 | /* | 833 | if (copy_from_user(&ins, addr, sizeof(ins))) |
834 | * What the fuck is going on here? We leave junk in the beginning | ||
835 | * of ins and then check the field pretty close to that beginning? | ||
836 | */ | ||
837 | if(copy_from_user(&((char *) &ins)[offs], addr + offs, sizeof(ins) - offs)) | ||
838 | return -EFAULT; | 834 | return -EFAULT; |
839 | 835 | ||
840 | if (ins.channel < 0 || ins.channel >= SBFM_MAXINSTR) | 836 | if (ins.channel < 0 || ins.channel >= SBFM_MAXINSTR) |
@@ -849,6 +845,10 @@ static int opl3_load_patch(int dev, int format, const char __user *addr, | |||
849 | 845 | ||
850 | static void opl3_panning(int dev, int voice, int value) | 846 | static void opl3_panning(int dev, int voice, int value) |
851 | { | 847 | { |
848 | |||
849 | if (voice < 0 || voice >= devc->nr_voice) | ||
850 | return; | ||
851 | |||
852 | devc->voc[voice].panning = value; | 852 | devc->voc[voice].panning = value; |
853 | } | 853 | } |
854 | 854 | ||
@@ -1066,8 +1066,15 @@ static int opl3_alloc_voice(int dev, int chn, int note, struct voice_alloc_info | |||
1066 | 1066 | ||
1067 | static void opl3_setup_voice(int dev, int voice, int chn) | 1067 | static void opl3_setup_voice(int dev, int voice, int chn) |
1068 | { | 1068 | { |
1069 | struct channel_info *info = | 1069 | struct channel_info *info; |
1070 | &synth_devs[dev]->chn_info[chn]; | 1070 | |
1071 | if (voice < 0 || voice >= devc->nr_voice) | ||
1072 | return; | ||
1073 | |||
1074 | if (chn < 0 || chn > 15) | ||
1075 | return; | ||
1076 | |||
1077 | info = &synth_devs[dev]->chn_info[chn]; | ||
1071 | 1078 | ||
1072 | opl3_set_instr(dev, voice, info->pgm_num); | 1079 | opl3_set_instr(dev, voice, info->pgm_num); |
1073 | 1080 | ||