summaryrefslogtreecommitdiff
path: root/sound/ppc/awacs.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/ppc/awacs.c')
-rw-r--r--sound/ppc/awacs.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 05dabe45465..b15bfb6f701 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -175,10 +175,12 @@ static int snd_pmac_awacs_put_volume(struct snd_kcontrol *kcontrol,
int inverted = (kcontrol->private_value >> 16) & 1;
int val, oldval;
unsigned long flags;
- int vol[2];
+ unsigned int vol[2];
vol[0] = ucontrol->value.integer.value[0];
vol[1] = ucontrol->value.integer.value[1];
+ if (vol[0] > 0x0f || vol[1] > 0x0f)
+ return -EINVAL;
if (inverted) {
vol[0] = 0x0f - vol[0];
vol[1] = 0x0f - vol[1];
@@ -421,10 +423,14 @@ static int snd_pmac_awacs_put_tone_amp(struct snd_kcontrol *kcontrol,
struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
int index = kcontrol->private_value;
struct awacs_amp *amp = chip->mixer_data;
+ unsigned int val;
snd_assert(amp, return -EINVAL);
snd_assert(index >= 0 && index <= 1, return -EINVAL);
- if (ucontrol->value.integer.value[0] != amp->amp_tone[index]) {
- amp->amp_tone[index] = ucontrol->value.integer.value[0];
+ val = ucontrol->value.integer.value[0];
+ if (val > 14)
+ return -EINVAL;
+ if (val != amp->amp_tone[index]) {
+ amp->amp_tone[index] = val;
awacs_amp_set_tone(amp, amp->amp_tone[0], amp->amp_tone[1]);
return 1;
}
@@ -456,9 +462,13 @@ static int snd_pmac_awacs_put_master_amp(struct snd_kcontrol *kcontrol,
{
struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
struct awacs_amp *amp = chip->mixer_data;
+ unsigned int val;
snd_assert(amp, return -EINVAL);
- if (ucontrol->value.integer.value[0] != amp->amp_master) {
- amp->amp_master = ucontrol->value.integer.value[0];
+ val = ucontrol->value.integer.value[0];
+ if (val > 99)
+ return -EINVAL;
+ if (val != amp->amp_master) {
+ amp->amp_master = val;
awacs_amp_set_master(amp, amp->amp_master);
return 1;
}