diff options
author | Baptiste Robert <baptistex.robert@intel.com> | 2013-08-07 11:32:45 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-05-06 19:36:06 +0200 |
commit | 6cd7d5f9870ef548bcb5a941061eeed9ad6b0d16 (patch) | |
tree | bc238785004f183d92572432af40edfb8dda71e3 | |
parent | 867920ca46cc8ddc726bc0d406c454c17b7b9262 (diff) |
Mixer: Check validity of input value
When the user wants to set a mixer with a value greater
than the maximum or smaller than the minimum, the mixer
is set at an undefined value.
This patch set purpose is to return a error if the input
value is out of range.
Signed-off-by: Baptiste Robert <baptistex.robert@intel.com>
Signed-off-by: David Wagner <david.wagner@intel.com>
Author-Tracking-BZ: 129089
-rw-r--r-- | mixer.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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; |