From patchwork Thu Apr 14 22:47:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 12814099 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D034DC433EF for ; Thu, 14 Apr 2022 22:47:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347332AbiDNWtt (ORCPT ); Thu, 14 Apr 2022 18:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347310AbiDNWtl (ORCPT ); Thu, 14 Apr 2022 18:49:41 -0400 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00F51C8BF1 for ; Thu, 14 Apr 2022 15:47:14 -0700 (PDT) Date: Thu, 14 Apr 2022 22:47:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail2; t=1649976433; bh=THMmkXXMS2lPNNZpAKvu3GAAetFAVRpTegVE6Ot/KkU=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=OXkMtj7iaWudLwGUwWTU7oX0NF7hArQWxhthVlcg3TIgPYTx8RSG42gqGiU0Cve2y BYUA9IRlAcKYpB5XNnNj4k722gX0u+C8vCyNGLg7RNfRkuQHvESq2c5D/kPWDzUDYX A/XxycqH1wvrAZuxlVmH94RVwUOQpoiaEIwfXOhor/M9wvCZfKI2z6k1RuLbsF7P8Q PwsttRM3exP3+TixGhFGgbb4dIM1Y7iyQ+f3v9LpeadgCzMQ+EDKRN71eUoZA+PsFQ DH7TZBmw8kyGraPfnf+/a1OXNifL7FRvUSS78NRqVmrT2SuuXgab8WjmEUww+SeRvE iiARFXOmOeWiw== To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko From: Alexander Lobakin Cc: 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 , Alexander Lobakin , 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, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Reply-To: Alexander Lobakin Subject: [PATCH bpf-next 10/11] samples: bpf: fix -Wsequence-point Message-ID: <20220414223704.341028-11-alobakin@pm.me> In-Reply-To: <20220414223704.341028-1-alobakin@pm.me> References: <20220414223704.341028-1-alobakin@pm.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net 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(-) -- 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; }