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

1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 2018-2019 SUSE LLC.
65 /* TODO: Once expanded, check zero-padding. */ in test_openat2_struct()
67 /* Smaller than version-0 struct. */ in test_openat2_struct()
68 { .name = "zero-sized 'struct'", in test_openat2_struct()
69 .arg.inner.flags = O_RDONLY, .size = 0, .err = -EINVAL }, in test_openat2_struct()
70 { .name = "smaller-than-v0 struct", in test_openat2_struct()
72 .size = OPEN_HOW_SIZE_VER0 - 1, .err = -EINVAL }, in test_openat2_struct()
74 /* Bigger struct, with non-zero trailing bytes. */ in test_openat2_struct()
75 { .name = "bigger struct (non-zero data in first 'future field')", in test_openat2_struct()
77 .size = sizeof(struct open_how_ext), .err = -E2BIG }, in test_openat2_struct()
78 { .name = "bigger struct (non-zero data in middle of 'future fields')", in test_openat2_struct()
80 .size = sizeof(struct open_how_ext), .err = -E2BIG }, in test_openat2_struct()
81 { .name = "bigger struct (non-zero data at end of 'future fields')", in test_openat2_struct()
83 .size = sizeof(struct open_how_ext), .err = -E2BIG }, in test_openat2_struct()
91 struct open_how_ext how_ext = test->arg; in test_openat2_struct()
110 * (mis)alignment offset. The other data is set to be non-zero to in test_openat2_struct()
111 * make sure that non-zero bytes outside the struct aren't checked in test_openat2_struct()
121 fd = raw_openat2(AT_FDCWD, ".", how_copy, test->size); in test_openat2_struct()
122 if (test->err >= 0) in test_openat2_struct()
125 failed = (fd != test->err); in test_openat2_struct()
138 ksft_print_msg("%d (%s)\n", fd, strerror(-fd)); in test_openat2_struct()
142 if (test->err >= 0) in test_openat2_struct()
144 test->name, misalign); in test_openat2_struct()
147 test->name, misalign, test->err, in test_openat2_struct()
148 strerror(-test->err)); in test_openat2_struct()
170 .how.flags = O_TMPFILE | O_PATH | O_RDWR, .err = -EINVAL }, in test_openat2_flags()
172 .how.flags = O_TMPFILE | O_CREAT | O_RDWR, .err = -EINVAL }, in test_openat2_flags()
183 .how.flags = O_PATH | O_RDWR, .err = -EINVAL }, in test_openat2_flags()
185 .how.flags = O_PATH | O_CREAT, .err = -EINVAL }, in test_openat2_flags()
187 .how.flags = O_PATH | O_EXCL, .err = -EINVAL }, in test_openat2_flags()
189 .how.flags = O_PATH | O_NOCTTY, .err = -EINVAL }, in test_openat2_flags()
191 .how.flags = O_PATH | O_DIRECT, .err = -EINVAL }, in test_openat2_flags()
193 .how.flags = O_PATH | O_LARGEFILE, .err = -EINVAL }, in test_openat2_flags()
195 /* ->mode must only be set with O_{CREAT,TMPFILE}. */ in test_openat2_flags()
196 { .name = "non-zero how.mode and O_RDONLY", in test_openat2_flags()
197 .how.flags = O_RDONLY, .how.mode = 0600, .err = -EINVAL }, in test_openat2_flags()
198 { .name = "non-zero how.mode and O_PATH", in test_openat2_flags()
199 .how.flags = O_PATH, .how.mode = 0600, .err = -EINVAL }, in test_openat2_flags()
204 /* ->mode must only contain 0777 bits. */ in test_openat2_flags()
207 .how.mode = 0xFFFF, .err = -EINVAL }, in test_openat2_flags()
210 .how.mode = 0xC000000000000000ULL, .err = -EINVAL }, in test_openat2_flags()
213 .how.mode = 0x1337, .err = -EINVAL }, in test_openat2_flags()
216 .how.mode = 0x0000A00000000000ULL, .err = -EINVAL }, in test_openat2_flags()
218 /* ->resolve flags must not conflict. */ in test_openat2_flags()
222 .err = -EINVAL }, in test_openat2_flags()
224 /* ->resolve must only contain RESOLVE_* flags. */ in test_openat2_flags()
227 .how.resolve = 0x1337, .err = -EINVAL }, in test_openat2_flags()
230 .how.resolve = 0x1337, .err = -EINVAL }, in test_openat2_flags()
233 .how.resolve = 0x1337, .err = -EINVAL }, in test_openat2_flags()
236 .how.resolve = 0x1337, .err = -EINVAL }, in test_openat2_flags()
241 .how.resolve = 0, .err = -EINVAL }, in test_openat2_flags()
247 int fd, fdflags = -1; in test_openat2_flags()
259 path = (test->how.flags & O_CREAT) ? "/tmp/ksft.openat2_tmpfile" : "."; in test_openat2_flags()
262 fd = sys_openat2(AT_FDCWD, path, &test->how); in test_openat2_flags()
263 if (fd < 0 && fd == -EOPNOTSUPP) { in test_openat2_flags()
269 test->name, fd, strerror(-fd)); in test_openat2_flags()
273 if (test->err >= 0) in test_openat2_flags()
276 failed = (fd != test->err); in test_openat2_flags()
292 if (test->how.flags & O_CREAT) in test_openat2_flags()
294 if (!(test->how.flags & O_LARGEFILE)) in test_openat2_flags()
296 failed |= (fdflags != test->how.flags); in test_openat2_flags()
306 test->how.flags); in test_openat2_flags()
308 ksft_print_msg("%d (%s)\n", fd, strerror(-fd)); in test_openat2_flags()
312 if (test->err >= 0) in test_openat2_flags()
313 resultfn("openat2 with %s succeeds\n", test->name); in test_openat2_flags()
316 test->name, test->err, strerror(-test->err)); in test_openat2_flags()