#include <linux/ctype.h>
#include <linux/mm.h>
#include <linux/math.h>
+#include <linux/nospec.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/poll.h>
struct gsm_config_ext ce;
struct gsm_dlci_config dc;
struct gsm_mux *gsm = tty->disc_data;
+ unsigned int base, addr;
struct gsm_dlci *dlci;
- unsigned int base;
switch (cmd) {
case GSMIOC_GETCONF:
return -EFAULT;
if (dc.channel == 0 || dc.channel >= NUM_DLCI)
return -EINVAL;
- dlci = gsm->dlci[dc.channel];
+ addr = array_index_nospec(dc.channel, NUM_DLCI);
+ dlci = gsm->dlci[addr];
if (!dlci) {
- dlci = gsm_dlci_alloc(gsm, dc.channel);
+ dlci = gsm_dlci_alloc(gsm, addr);
if (!dlci)
return -ENOMEM;
}
return -EFAULT;
if (dc.channel == 0 || dc.channel >= NUM_DLCI)
return -EINVAL;
- dlci = gsm->dlci[dc.channel];
+ addr = array_index_nospec(dc.channel, NUM_DLCI);
+ dlci = gsm->dlci[addr];
if (!dlci) {
- dlci = gsm_dlci_alloc(gsm, dc.channel);
+ dlci = gsm_dlci_alloc(gsm, addr);
if (!dlci)
return -ENOMEM;
}