Message ID | 20220414223704.341028-11-alobakin@pm.me (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | BPF |
Headers | show |
Series | bpf: random unpopular userspace fixes (32 bit et al.) | expand |
Context | Check | Description |
---|---|---|
bpf/vmtest-bpf-next-PR | success | PR summary |
netdev/tree_selection | success | Clearly marked for bpf-next, async |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 14 of 14 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/verify_fixes | success | Fixes tag looks correct |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 9 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
bpf/vmtest-bpf-next-VM_Test-1 | success | Logs for Kernel LATEST on ubuntu-latest + selftests |
bpf/vmtest-bpf-next-VM_Test-2 | success | Logs for Kernel LATEST on z15 + selftests |
On Thu, Apr 14, 2022 at 3:47 PM Alexander Lobakin <alobakin@pm.me> wrote: > > In some libc implementations, CPU_SET() may utilize its first > argument several times. When combined with a post-increment, it > leads to: > > samples/bpf/test_lru_dist.c:233:36: warning: operation on 'next_to_try' may be undefined [-Wsequence-point] > 233 | CPU_SET(next_to_try++, &cpuset); > | ^ > > Split the sentence into two standalone operations to fix this. > > Fixes: 5db58faf989f ("bpf: Add tests for the LRU bpf_htab") > Signed-off-by: Alexander Lobakin <alobakin@pm.me> Acked-by: Song Liu <songliubraving@fb.com> > --- > samples/bpf/test_lru_dist.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/samples/bpf/test_lru_dist.c b/samples/bpf/test_lru_dist.c > index be98ccb4952f..191643ec501e 100644 > --- a/samples/bpf/test_lru_dist.c > +++ b/samples/bpf/test_lru_dist.c > @@ -229,7 +229,8 @@ static int sched_next_online(int pid, int next_to_try) > > while (next_to_try < nr_cpus) { > CPU_ZERO(&cpuset); > - CPU_SET(next_to_try++, &cpuset); > + CPU_SET(next_to_try, &cpuset); > + next_to_try++; > if (!sched_setaffinity(pid, sizeof(cpuset), &cpuset)) > break; > } > -- > 2.35.2 > >
diff --git a/samples/bpf/test_lru_dist.c b/samples/bpf/test_lru_dist.c index be98ccb4952f..191643ec501e 100644 --- a/samples/bpf/test_lru_dist.c +++ b/samples/bpf/test_lru_dist.c @@ -229,7 +229,8 @@ static int sched_next_online(int pid, int next_to_try) while (next_to_try < nr_cpus) { CPU_ZERO(&cpuset); - CPU_SET(next_to_try++, &cpuset); + CPU_SET(next_to_try, &cpuset); + next_to_try++; if (!sched_setaffinity(pid, sizeof(cpuset), &cpuset)) break; }
In some libc implementations, CPU_SET() may utilize its first argument several times. When combined with a post-increment, it leads to: samples/bpf/test_lru_dist.c:233:36: warning: operation on 'next_to_try' may be undefined [-Wsequence-point] 233 | CPU_SET(next_to_try++, &cpuset); | ^ Split the sentence into two standalone operations to fix this. Fixes: 5db58faf989f ("bpf: Add tests for the LRU bpf_htab") Signed-off-by: Alexander Lobakin <alobakin@pm.me> --- samples/bpf/test_lru_dist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.35.2