File tree Expand file tree Collapse file tree 1 file changed +6
-19
lines changed Expand file tree Collapse file tree 1 file changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -67,32 +67,19 @@ int bpf_check_uarg_tail_zero(void __user *uaddr,
67
67
size_t expected_size ,
68
68
size_t actual_size )
69
69
{
70
- unsigned char __user * addr ;
71
- unsigned char __user * end ;
72
- unsigned char val ;
73
- int err ;
70
+ unsigned char __user * addr = uaddr + expected_size ;
71
+ int res ;
74
72
75
73
if (unlikely (actual_size > PAGE_SIZE )) /* silly large */
76
74
return - E2BIG ;
77
75
78
- if (unlikely (!access_ok (uaddr , actual_size )))
79
- return - EFAULT ;
80
-
81
76
if (actual_size <= expected_size )
82
77
return 0 ;
83
78
84
- addr = uaddr + expected_size ;
85
- end = uaddr + actual_size ;
86
-
87
- for (; addr < end ; addr ++ ) {
88
- err = get_user (val , addr );
89
- if (err )
90
- return err ;
91
- if (val )
92
- return - E2BIG ;
93
- }
94
-
95
- return 0 ;
79
+ res = check_zeroed_user (addr , actual_size - expected_size );
80
+ if (res < 0 )
81
+ return res ;
82
+ return res ? 0 : - E2BIG ;
96
83
}
97
84
98
85
const struct bpf_map_ops bpf_map_offload_ops = {
You can’t perform that action at this time.
0 commit comments