[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW4kqcjgd=ckUDToebvGUmRUJC290ryJShbPDzv43S0kvg@mail.gmail.com>
Date: Fri, 15 Apr 2022 16:56:25 -0700
From: Song Liu <song@...nel.org>
To: Alexander Lobakin <alobakin@...me>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Björn Töpel <bjorn@...nel.org>,
Magnus Karlsson <magnus.karlsson@...el.com>,
Jonathan Lemon <jonathan.lemon@...il.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Dmitrii Dolgov <9erthalion6@...il.com>,
Quentin Monnet <quentin@...valent.com>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
Kumar Kartikeya Dwivedi <memxor@...il.com>,
Chenbo Feng <fengc@...gle.com>,
Willem de Bruijn <willemb@...gle.com>,
Daniel Wagner <daniel.wagner@...-carit.de>,
Thomas Graf <tgraf@...g.ch>,
Ong Boon Leong <boon.leong.ong@...el.com>,
linux-perf-users@...r.kernel.org,
open list <linux-kernel@...r.kernel.org>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
llvm@...ts.linux.dev
Subject: Re: [PATCH bpf-next 10/11] samples: bpf: fix -Wsequence-point
On Thu, Apr 14, 2022 at 3:47 PM Alexander Lobakin <alobakin@...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@...me>
Acked-by: Song Liu <songliubraving@...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
>
>
Powered by blists - more mailing lists