summaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-05-10 01:25:18 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-05-10 01:25:18 -0700
commit6e5dae3ae1af25ac48b005ccfb2cf7e033d312ce (patch)
treeae877abfc5e691423dd5dbafab2a2eda81760e58 /include/sound
parentd7521d9bb9408dd4225b9838e23a80ecc41f80fa (diff)
parent028ce831e8f14cc94f14929f1a91d198ea2d9b93 (diff)
Merge "Merge android-4.4.131 (d5d6526) into msm-4.4"
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/control.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/sound/control.h b/include/sound/control.h
index 21d047f229a1..4142757080f8 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -22,6 +22,7 @@
*
*/
+#include <linux/nospec.h>
#include <sound/asound.h>
#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data)
@@ -147,12 +148,14 @@ int snd_ctl_get_preferred_subdevice(struct snd_card *card, int type);
static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
{
- return id->numid - kctl->id.numid;
+ unsigned int ioff = id->numid - kctl->id.numid;
+ return array_index_nospec(ioff, kctl->count);
}
static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
{
- return id->index - kctl->id.index;
+ unsigned int ioff = id->index - kctl->id.index;
+ return array_index_nospec(ioff, kctl->count);
}
static inline unsigned int snd_ctl_get_ioff(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)