From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3F8833F4 for ; Fri, 15 Apr 2022 23:56:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84706C385B2 for ; Fri, 15 Apr 2022 23:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650066997; bh=6MeCF3Sbghhbx4Nc1Tx4NayNkdJXWablaTdOWyN92Sc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nZPwFrqZKGvCtPxx7/aApRjqIo3gJppWAvu4722/OF2g/TrxPiZseK7Kvd8AiE4K+ 3tsMsZ7Kd/rKRELsj9yBKqBvBtD293A9Vj/MeE5g2f96rBHdBXvw8Zxn8j78NbCGTB Kr7Grxe2JzW0K7OEJzOYtP0Y48bhbU+sW9NMZdsrwQ0/Mj/S9CNP/pjvgU4lVrOP4B FKj/KO/ASt+lzDVghuZOkmw5KtrlMdvvQL1rNUCX4snmre4TMKdgyI2j0E+0Cr1yW8 UchkOMihSiUhKWbb51Vo4MQ5Cv4PPczPBiiMQXDsSHDD3AuPIC/z/Btex+59GpA1rl ERdCNZkO8d7Jw== Received: by mail-yb1-f170.google.com with SMTP id g34so16773122ybj.1 for ; Fri, 15 Apr 2022 16:56:37 -0700 (PDT) X-Gm-Message-State: AOAM532QMCTCnc4q+Gc8gO4oogmkRg8ZN0ahSYSzHT4Fp5A/6PUE04F6 pIaagTlB6ar6N+G/pO5lJ7l4+00UbmTl1XQPWBc= X-Google-Smtp-Source: ABdhPJyXgrsL54epueeF7YOhlez6BRY3vO4KvzuACHTCURJPUspz60IcOFcrWXrFgtwea5S6eI523ixLqfjUo8hkbfw= X-Received: by 2002:a25:d40e:0:b0:641:1842:ed4b with SMTP id m14-20020a25d40e000000b006411842ed4bmr1401360ybf.257.1650066996589; Fri, 15 Apr 2022 16:56:36 -0700 (PDT) Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20220414223704.341028-1-alobakin@pm.me> <20220414223704.341028-11-alobakin@pm.me> In-Reply-To: <20220414223704.341028-11-alobakin@pm.me> From: Song Liu Date: Fri, 15 Apr 2022 16:56:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next 10/11] samples: bpf: fix -Wsequence-point To: Alexander Lobakin Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jonathan Lemon , Nathan Chancellor , Nick Desaulniers , Dmitrii Dolgov <9erthalion6@gmail.com>, Quentin Monnet , Tiezhu Yang , Kumar Kartikeya Dwivedi , Chenbo Feng , Willem de Bruijn , Daniel Wagner , Thomas Graf , Ong Boon Leong , linux-perf-users@vger.kernel.org, open list , Networking , bpf , llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" On Thu, Apr 14, 2022 at 3:47 PM Alexander Lobakin 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 Acked-by: Song Liu > --- > 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 > >