diff options
author | Luis R. Rodriguez <mcgrof@kernel.org> | 2017-07-12 17:33:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-12 19:26:00 -0400 |
commit | 7c43a657a4beadeb6d2fe1a00732261e313a807f (patch) | |
tree | 136df4cf9e16868c81d502ca8b6f3284546c81c6 /lib/test_sysctl.c | |
parent | 2920fad3a5d394b66011c7f35c7b05278354055e (diff) |
test_sysctl: test against int proc_dointvec() array support
Add a few initial respective tests for an array:
o Echoing values separated by spaces works
o Echoing only first elements will set first elements
o Confirm PAGE_SIZE limit still applies even if an array is used
Link: http://lkml.kernel.org/r/20170630224431.17374-7-mcgrof@kernel.org
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/test_sysctl.c')
-rw-r--r-- | lib/test_sysctl.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c index 53db3513ab08..3dd801c1c85b 100644 --- a/lib/test_sysctl.c +++ b/lib/test_sysctl.c | |||
@@ -42,6 +42,7 @@ static int i_one_hundred = 100; | |||
42 | struct test_sysctl_data { | 42 | struct test_sysctl_data { |
43 | int int_0001; | 43 | int int_0001; |
44 | int int_0002; | 44 | int int_0002; |
45 | int int_0003[4]; | ||
45 | 46 | ||
46 | unsigned int uint_0001; | 47 | unsigned int uint_0001; |
47 | 48 | ||
@@ -52,6 +53,11 @@ static struct test_sysctl_data test_data = { | |||
52 | .int_0001 = 60, | 53 | .int_0001 = 60, |
53 | .int_0002 = 1, | 54 | .int_0002 = 1, |
54 | 55 | ||
56 | .int_0003[0] = 0, | ||
57 | .int_0003[1] = 1, | ||
58 | .int_0003[2] = 2, | ||
59 | .int_0003[3] = 3, | ||
60 | |||
55 | .uint_0001 = 314, | 61 | .uint_0001 = 314, |
56 | 62 | ||
57 | .string_0001 = "(none)", | 63 | .string_0001 = "(none)", |
@@ -76,6 +82,13 @@ static struct ctl_table test_table[] = { | |||
76 | .proc_handler = proc_dointvec, | 82 | .proc_handler = proc_dointvec, |
77 | }, | 83 | }, |
78 | { | 84 | { |
85 | .procname = "int_0003", | ||
86 | .data = &test_data.int_0003, | ||
87 | .maxlen = sizeof(test_data.int_0003), | ||
88 | .mode = 0644, | ||
89 | .proc_handler = proc_dointvec, | ||
90 | }, | ||
91 | { | ||
79 | .procname = "uint_0001", | 92 | .procname = "uint_0001", |
80 | .data = &test_data.uint_0001, | 93 | .data = &test_data.uint_0001, |
81 | .maxlen = sizeof(unsigned int), | 94 | .maxlen = sizeof(unsigned int), |