On 2/7/23 15:44, Kevin Brodsky wrote:
On 02/02/2023 10:26, Amit Daniel Kachhap wrote:
Gcc toolchain generates the following warnings,
clone.c:328:17: warning: missing initializer for field ‘set_tid_size’ of ‘struct clone_args’ [-Wmissing-field-initializers] 328 | .args.set_tid_size = 1,
This warning looks bogus, and indeed I've managed to put together a small reproducer showing that it only occurs with Morello GCC, not upstream GCC (in the presence of the line above with the compound literal initialiser). I've reported it to the GNU team, for now I would drop this patch.
Thanks for analyzing this patch. I will drop this from v3.
Amit
Kevin
Fix the above warnings by using the following syntax to initialize the structure fields, struct clone_args args = { .set_tid_size = 1; };
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com
tools/testing/selftests/arm64/morello/clone.c | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-)
diff --git a/tools/testing/selftests/arm64/morello/clone.c b/tools/testing/selftests/arm64/morello/clone.c index d42a8b5a0eb5..f261d0fd88f3 100644 --- a/tools/testing/selftests/arm64/morello/clone.c +++ b/tools/testing/selftests/arm64/morello/clone.c @@ -286,35 +286,47 @@ static struct clone3_fixture { }, /* @{0} */ /* invalid set_tid array size */ {
.args.set_tid_size = MAX_PID_NS_LEVEL + 1,
.args = {
.set_tid_size = MAX_PID_NS_LEVEL + 1,
.e_result = -EINVAL }, /* @{1} */ /* Invalid combination of set_tid & set_tid_size */ {},
.args.set_tid_size = 1,
.args = {
.set_tid_size = 1,
.e_result = -EINVAL }, /* @{2} */ /* Invalid exit_signal */ {},
.args.exit_signal = _NSIG + 1,
.args = {
.exit_signal = _NSIG + 1,
.e_result = -EINVAL }, /* @{3} */ /* Invalid cgroup number */ {},
.args.flags = CLONE_INTO_CGROUP,
.args.cgroup = (__u64)INT_MAX + 1,
.args = {
.flags = CLONE_INTO_CGROUP,
.cgroup = (__u64)INT_MAX + 1,
.e_result = -EINVAL }, /* @{4} */ /* Invalid size for clone_args with cgroup */ { .args_size = offsetof(struct clone_args, cgroup),},
.args.flags = CLONE_INTO_CGROUP,
.args.cgroup = 1,
.args = {
.flags = CLONE_INTO_CGROUP,
.cgroup = 1,
.e_result = -EINVAL }, /* @{5} */ /* Invalid stack & stack_size combination */ {},
.args.stack_size = STACK_SIZE,
.args = {
.stack_size = STACK_SIZE,
.test_flags = CUSTOM_CLONE_STACK_INV, .e_result = -EINVAL }, /* @{6} */},
@@ -324,23 +336,31 @@ static struct clone3_fixture { }, /* @{7} */ /* Invalid set_tid entry */ {
.args.set_tid = (uintptr_t)&(pid_t){1},
.args.set_tid_size = 1,
.args = {
.set_tid = (uintptr_t)&(pid_t){1},
.set_tid_size = 1
.e_result = -EEXIST }, /* @{8} */},
/* END_SECTION: expected failure */ {
.args.flags = CLONE_PIDFD | CLONE_CHILD_SETTID |
CLONE_CHILD_CLEARTID,
.args = {
.flags = CLONE_PIDFD | CLONE_CHILD_SETTID |
CLONE_CHILD_CLEARTID,
.e_result = 0 }, /* @{9} */ {},
.args.flags = CLONE_PARENT_SETTID | CLONE_CHILD_SETTID,
.args = {
.flags = CLONE_PARENT_SETTID | CLONE_CHILD_SETTID,
.e_result = 0 }, /* @{10} */ {},
.args.flags = CLONE_SETTLS,
.args = {
.flags = CLONE_SETTLS,
.e_result = 0 }, /* @{11} */ };},