On 22/6/26 23:24, [email protected] wrote:
>> diff --git a/tools/testing/selftests/bpf/prog_tests/global_data_init.c 
>> b/tools/testing/selftests/bpf/prog_tests/global_data_init.c
>> index e4c290492ff8..32734e1dbfb0 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/global_data_init.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/global_data_init.c
>> @@ -279,6 +279,56 @@ static void test_global_percpu_data_verifier_log(void)
> 
> [ ... ]
> 
>> +    fd = bpf_iter_create(bpf_link__fd(link));
>> +    if (!ASSERT_GE(fd, 0, "bpf_iter_create"))
>> +            goto out;
>> +
>> +    while ((len = read(fd, buf, sizeof(buf))) > 0)
>> +            do { } while (0);
>> +    ASSERT_EQ(len, 0, "read iter");
> 
> This isn't a bug, but could the empty drain body here be a bare ';'
> rather than 'do { } while (0);'?  The other bpf_iter tests in this
> directory (prog_tests/bpf_iter.c) drain the iterator fd with a bare ';',
> so a plain ';' would read more like the neighbouring code.
> 
> 
I think 'do { } while (0);' is more readable than a dangling ';', and
avoids -Wempty-body warning btw.

Thanks,
Leon


Reply via email to