| .. | .. |
|---|
| 10 | 10 | #include <linux/kernel.h> |
|---|
| 11 | 11 | #include <linux/errno.h> |
|---|
| 12 | 12 | #include <linux/jiffies.h> |
|---|
| 13 | +#include <linux/nospec.h> |
|---|
| 13 | 14 | #include <linux/skbuff.h> |
|---|
| 14 | 15 | #include <linux/string.h> |
|---|
| 15 | 16 | #include <linux/types.h> |
|---|
| .. | .. |
|---|
| 369 | 370 | if (type <= 0 || type > maxtype) |
|---|
| 370 | 371 | return 0; |
|---|
| 371 | 372 | |
|---|
| 373 | + type = array_index_nospec(type, maxtype + 1); |
|---|
| 372 | 374 | pt = &policy[type]; |
|---|
| 373 | 375 | |
|---|
| 374 | 376 | BUG_ON(pt->type > NLA_TYPE_MAX); |
|---|
| .. | .. |
|---|
| 584 | 586 | } |
|---|
| 585 | 587 | continue; |
|---|
| 586 | 588 | } |
|---|
| 589 | + type = array_index_nospec(type, maxtype + 1); |
|---|
| 587 | 590 | if (policy) { |
|---|
| 588 | 591 | int err = validate_nla(nla, maxtype, policy, |
|---|
| 589 | 592 | validate, extack, depth); |
|---|