9
9
#define KUNIT_PROC_READ 0
10
10
#define KUNIT_PROC_WRITE 1
11
11
12
- static int i_zero ;
13
- static int i_one_hundred = 100 ;
14
-
15
12
/*
16
13
* Test that proc_dointvec will not try to use a NULL .data field even when the
17
14
* length is non-zero.
@@ -29,8 +26,8 @@ static void sysctl_test_api_dointvec_null_tbl_data(struct kunit *test)
29
26
.maxlen = sizeof (int ),
30
27
.mode = 0644 ,
31
28
.proc_handler = proc_dointvec ,
32
- .extra1 = & i_zero ,
33
- .extra2 = & i_one_hundred ,
29
+ .extra1 = SYSCTL_ZERO ,
30
+ .extra2 = SYSCTL_ONE_HUNDRED ,
34
31
};
35
32
/*
36
33
* proc_dointvec expects a buffer in user space, so we allocate one. We
@@ -79,8 +76,8 @@ static void sysctl_test_api_dointvec_table_maxlen_unset(struct kunit *test)
79
76
.maxlen = 0 ,
80
77
.mode = 0644 ,
81
78
.proc_handler = proc_dointvec ,
82
- .extra1 = & i_zero ,
83
- .extra2 = & i_one_hundred ,
79
+ .extra1 = SYSCTL_ZERO ,
80
+ .extra2 = SYSCTL_ONE_HUNDRED ,
84
81
};
85
82
void __user * buffer = (void __user * )kunit_kzalloc (test , sizeof (int ),
86
83
GFP_USER );
@@ -122,8 +119,8 @@ static void sysctl_test_api_dointvec_table_len_is_zero(struct kunit *test)
122
119
.maxlen = sizeof (int ),
123
120
.mode = 0644 ,
124
121
.proc_handler = proc_dointvec ,
125
- .extra1 = & i_zero ,
126
- .extra2 = & i_one_hundred ,
122
+ .extra1 = SYSCTL_ZERO ,
123
+ .extra2 = SYSCTL_ONE_HUNDRED ,
127
124
};
128
125
void __user * buffer = (void __user * )kunit_kzalloc (test , sizeof (int ),
129
126
GFP_USER );
@@ -156,8 +153,8 @@ static void sysctl_test_api_dointvec_table_read_but_position_set(
156
153
.maxlen = sizeof (int ),
157
154
.mode = 0644 ,
158
155
.proc_handler = proc_dointvec ,
159
- .extra1 = & i_zero ,
160
- .extra2 = & i_one_hundred ,
156
+ .extra1 = SYSCTL_ZERO ,
157
+ .extra2 = SYSCTL_ONE_HUNDRED ,
161
158
};
162
159
void __user * buffer = (void __user * )kunit_kzalloc (test , sizeof (int ),
163
160
GFP_USER );
@@ -191,8 +188,8 @@ static void sysctl_test_dointvec_read_happy_single_positive(struct kunit *test)
191
188
.maxlen = sizeof (int ),
192
189
.mode = 0644 ,
193
190
.proc_handler = proc_dointvec ,
194
- .extra1 = & i_zero ,
195
- .extra2 = & i_one_hundred ,
191
+ .extra1 = SYSCTL_ZERO ,
192
+ .extra2 = SYSCTL_ONE_HUNDRED ,
196
193
};
197
194
size_t len = 4 ;
198
195
loff_t pos = 0 ;
@@ -222,8 +219,8 @@ static void sysctl_test_dointvec_read_happy_single_negative(struct kunit *test)
222
219
.maxlen = sizeof (int ),
223
220
.mode = 0644 ,
224
221
.proc_handler = proc_dointvec ,
225
- .extra1 = & i_zero ,
226
- .extra2 = & i_one_hundred ,
222
+ .extra1 = SYSCTL_ZERO ,
223
+ .extra2 = SYSCTL_ONE_HUNDRED ,
227
224
};
228
225
size_t len = 5 ;
229
226
loff_t pos = 0 ;
@@ -251,8 +248,8 @@ static void sysctl_test_dointvec_write_happy_single_positive(struct kunit *test)
251
248
.maxlen = sizeof (int ),
252
249
.mode = 0644 ,
253
250
.proc_handler = proc_dointvec ,
254
- .extra1 = & i_zero ,
255
- .extra2 = & i_one_hundred ,
251
+ .extra1 = SYSCTL_ZERO ,
252
+ .extra2 = SYSCTL_ONE_HUNDRED ,
256
253
};
257
254
char input [] = "9" ;
258
255
size_t len = sizeof (input ) - 1 ;
@@ -281,8 +278,8 @@ static void sysctl_test_dointvec_write_happy_single_negative(struct kunit *test)
281
278
.maxlen = sizeof (int ),
282
279
.mode = 0644 ,
283
280
.proc_handler = proc_dointvec ,
284
- .extra1 = & i_zero ,
285
- .extra2 = & i_one_hundred ,
281
+ .extra1 = SYSCTL_ZERO ,
282
+ .extra2 = SYSCTL_ONE_HUNDRED ,
286
283
};
287
284
char input [] = "-9" ;
288
285
size_t len = sizeof (input ) - 1 ;
@@ -313,8 +310,8 @@ static void sysctl_test_api_dointvec_write_single_less_int_min(
313
310
.maxlen = sizeof (int ),
314
311
.mode = 0644 ,
315
312
.proc_handler = proc_dointvec ,
316
- .extra1 = & i_zero ,
317
- .extra2 = & i_one_hundred ,
313
+ .extra1 = SYSCTL_ZERO ,
314
+ .extra2 = SYSCTL_ONE_HUNDRED ,
318
315
};
319
316
size_t max_len = 32 , len = max_len ;
320
317
loff_t pos = 0 ;
@@ -351,8 +348,8 @@ static void sysctl_test_api_dointvec_write_single_greater_int_max(
351
348
.maxlen = sizeof (int ),
352
349
.mode = 0644 ,
353
350
.proc_handler = proc_dointvec ,
354
- .extra1 = & i_zero ,
355
- .extra2 = & i_one_hundred ,
351
+ .extra1 = SYSCTL_ZERO ,
352
+ .extra2 = SYSCTL_ONE_HUNDRED ,
356
353
};
357
354
size_t max_len = 32 , len = max_len ;
358
355
loff_t pos = 0 ;
0 commit comments