aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2014-05-07 06:35:42 -0700
committerSimon Wilson <simonwilson@google.com>2014-05-07 06:35:42 -0700
commit25e5e789c50105c1eca5bcfd37aa00327817fe45 (patch)
tree1797c95168f108d3cf779ddc9427515932b666bb
parentc73afc593d6b714c82813b943f69067fb4fa4234 (diff)
parent6cd7d5f9870ef548bcb5a941061eeed9ad6b0d16 (diff)
Merge pull request #40 from dawagner/check-mixer-input-value
Mixer: Check validity of input value
-rw-r--r--mixer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mixer.c b/mixer.c
index 8e99fad..b6c854f 100644
--- a/mixer.c
+++ b/mixer.c
@@ -392,6 +392,11 @@ int mixer_ctl_set_value(struct mixer_ctl *ctl, unsigned int id, int value)
break;
case SNDRV_CTL_ELEM_TYPE_INTEGER:
+ if ((value < mixer_ctl_get_range_min(ctl)) ||
+ (value > mixer_ctl_get_range_max(ctl))) {
+ return -EINVAL;
+ }
+
ev.value.integer.value[id] = value;
break;