|
@@ -23,6 +23,7 @@
|
|
|
*/
|
|
|
|
|
|
#include <linux/wait.h>
|
|
|
+#include <linux/nospec.h>
|
|
|
#include <sound/asound.h>
|
|
|
|
|
|
#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data)
|
|
@@ -148,12 +149,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)
|