Lines Matching +full:non +full:- +full:zero

1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 2018-2019 SUSE LLC.
60 /* TODO: Once expanded, check zero-padding. */ in test_openat2_struct()
62 /* Smaller than version-0 struct. */ in test_openat2_struct()
63 { .name = "zero-sized 'struct'", in test_openat2_struct()
64 .arg.inner.flags = O_RDONLY, .size = 0, .err = -EINVAL }, in test_openat2_struct()
65 { .name = "smaller-than-v0 struct", in test_openat2_struct()
67 .size = OPEN_HOW_SIZE_VER0 - 1, .err = -EINVAL }, in test_openat2_struct()
69 /* Bigger struct, with non-zero trailing bytes. */ in test_openat2_struct()
70 { .name = "bigger struct (non-zero data in first 'future field')", in test_openat2_struct()
72 .size = sizeof(struct open_how_ext), .err = -E2BIG }, in test_openat2_struct()
73 { .name = "bigger struct (non-zero data in middle of 'future fields')", in test_openat2_struct()
75 .size = sizeof(struct open_how_ext), .err = -E2BIG }, in test_openat2_struct()
76 { .name = "bigger struct (non-zero data at end of 'future fields')", in test_openat2_struct()
78 .size = sizeof(struct open_how_ext), .err = -E2BIG }, in test_openat2_struct()
86 struct open_how_ext how_ext = test->arg; in test_openat2_struct()
105 * (mis)alignment offset. The other data is set to be non-zero to in test_openat2_struct()
106 * make sure that non-zero bytes outside the struct aren't checked in test_openat2_struct()
116 fd = raw_openat2(AT_FDCWD, ".", how_copy, test->size); in test_openat2_struct()
117 if (test->err >= 0) in test_openat2_struct()
120 failed = (fd != test->err); in test_openat2_struct()
133 ksft_print_msg("%d (%s)\n", fd, strerror(-fd)); in test_openat2_struct()
137 if (test->err >= 0) in test_openat2_struct()
139 test->name, misalign); in test_openat2_struct()
142 test->name, misalign, test->err, in test_openat2_struct()
143 strerror(-test->err)); in test_openat2_struct()
165 .how.flags = O_TMPFILE | O_PATH | O_RDWR, .err = -EINVAL }, in test_openat2_flags()
167 .how.flags = O_TMPFILE | O_CREAT | O_RDWR, .err = -EINVAL }, in test_openat2_flags()
178 .how.flags = O_PATH | O_RDWR, .err = -EINVAL }, in test_openat2_flags()
180 .how.flags = O_PATH | O_CREAT, .err = -EINVAL }, in test_openat2_flags()
182 .how.flags = O_PATH | O_EXCL, .err = -EINVAL }, in test_openat2_flags()
184 .how.flags = O_PATH | O_NOCTTY, .err = -EINVAL }, in test_openat2_flags()
186 .how.flags = O_PATH | O_DIRECT, .err = -EINVAL }, in test_openat2_flags()
188 .how.flags = O_PATH | O_LARGEFILE, .err = -EINVAL }, in test_openat2_flags()
190 /* ->mode must only be set with O_{CREAT,TMPFILE}. */ in test_openat2_flags()
191 { .name = "non-zero how.mode and O_RDONLY", in test_openat2_flags()
192 .how.flags = O_RDONLY, .how.mode = 0600, .err = -EINVAL }, in test_openat2_flags()
193 { .name = "non-zero how.mode and O_PATH", in test_openat2_flags()
194 .how.flags = O_PATH, .how.mode = 0600, .err = -EINVAL }, in test_openat2_flags()
199 /* ->mode must only contain 0777 bits. */ in test_openat2_flags()
202 .how.mode = 0xFFFF, .err = -EINVAL }, in test_openat2_flags()
205 .how.mode = 0xC000000000000000ULL, .err = -EINVAL }, in test_openat2_flags()
208 .how.mode = 0x1337, .err = -EINVAL }, in test_openat2_flags()
211 .how.mode = 0x0000A00000000000ULL, .err = -EINVAL }, in test_openat2_flags()
213 /* ->resolve must only contain RESOLVE_* flags. */ in test_openat2_flags()
216 .how.resolve = 0x1337, .err = -EINVAL }, in test_openat2_flags()
219 .how.resolve = 0x1337, .err = -EINVAL }, in test_openat2_flags()
222 .how.resolve = 0x1337, .err = -EINVAL }, in test_openat2_flags()
225 .how.resolve = 0x1337, .err = -EINVAL }, in test_openat2_flags()
231 int fd, fdflags = -1; in test_openat2_flags()
243 path = (test->how.flags & O_CREAT) ? "/tmp/ksft.openat2_tmpfile" : "."; in test_openat2_flags()
246 fd = sys_openat2(AT_FDCWD, path, &test->how); in test_openat2_flags()
247 if (test->err >= 0) in test_openat2_flags()
250 failed = (fd != test->err); in test_openat2_flags()
266 if (test->how.flags & O_CREAT) in test_openat2_flags()
268 if (!(test->how.flags & O_LARGEFILE)) in test_openat2_flags()
270 failed |= (fdflags != test->how.flags); in test_openat2_flags()
280 test->how.flags); in test_openat2_flags()
282 ksft_print_msg("%d (%s)\n", fd, strerror(-fd)); in test_openat2_flags()
286 if (test->err >= 0) in test_openat2_flags()
287 resultfn("openat2 with %s succeeds\n", test->name); in test_openat2_flags()
290 test->name, test->err, strerror(-test->err)); in test_openat2_flags()