forked fromtorvalds/linux
- Notifications
You must be signed in to change notification settings - Fork0
Commitb1cd1b6
USB: gadget: u_f: add overflow checks to VLA macros
size can potentially hold an overflowed value if its assigned expressionis left unchecked, leading to a smaller than needed allocation whenvla_group_size() is used by callers to allocate memory.To fix this, add a test for saturation before declaring variables and anoverflow check to (n) * sizeof(type).If the expression results in overflow, vla_group_size() will return SIZE_MAX.Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>Suggested-by: Kees Cook <keescook@chromium.org>Signed-off-by: Brooke Basile <brookebasile@gmail.com>Acked-by: Felipe Balbi <balbi@kernel.org>Cc: stable <stable@kernel.org>Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parentf1ec7ae commitb1cd1b6
1 file changed
+27
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
28 | 37 | | |
29 | 38 | | |
30 | 39 | | |
31 | 40 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
39 | 55 | | |
40 | 56 | | |
41 | 57 | | |
| |||
0 commit comments
Comments
(0)