Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1034035pxb; Fri, 15 Apr 2022 19:04:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwiYX6y8KY27hspa5BG3dxuZCsU09Xcddu0fE5BMjTvyS1OyX6iw0weae/s2Zr2W4n49bb X-Received: by 2002:a65:4108:0:b0:399:1f0e:50da with SMTP id w8-20020a654108000000b003991f0e50damr1393418pgp.2.1650074666269; Fri, 15 Apr 2022 19:04:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650074666; cv=none; d=google.com; s=arc-20160816; b=u/qIJdnpR1OJhCq0mTFke/txX+57OIl8eqtMkbQjyd7SaQowSPNbNu2jpfjAHqG4DK zzFjp2B3SfBDwnLLibkXXZ0BwMgMB34UdtHlYarUcm9Qcy4ug6jcnE7xRIm1rGQP8x1z +8HlH835DhhRMiRdezmPG41DEAUgh1+yuo0MVyM2Eoxkn4z7jfSDtDuU+9Hho8gxh8UK yn7pPlVdKF0Uu0IXB9LvreJbkR1fvplaN2g6biUtpPSlTH2We9L+aW5y6RILjX1eXj0J uKsrIIyPgqwm3g9cDTPkFynRpeKKPKQq33gWLt7MJtGPpprVFQ6xK933m75ZjtoDOoEL VH3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=THMmkXXMS2lPNNZpAKvu3GAAetFAVRpTegVE6Ot/KkU=; b=EEfFQd5y9DYexcxewpskDYnfLiSky2xww05bUX3pW0xf08IGn259wrlD5wYeGT3YCO MKpMQ9fvWh4z3QlFUz8zy/qDgfMnVThXvwarvBRhiF7lhLzZwHBZ+GMtYQoqrYjUVAKY 5kcRosm3bs3DjgkCrOI/JaA/XFzK4rgmJnyIVJvrfIA3n5gnWYIrGRWCmRr0dwv+HbfE ZJnmdo3wlxt9Hn4f83fIyLkxpSsEis44pIUblCbk6DhgUuna3FpCr7BXOII80IW/rCP1 Dxues3XC6CaW6koKZx9M5Zj3/c88LxQXnDjo0XvK9PWTdwCzoA/bv0Iblyuoy+gwniKp TBZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail2 header.b=OXkMtj7i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o13-20020a63730d000000b0039960544d26si2820582pgc.611.2022.04.15.19.04.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:04:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail2 header.b=OXkMtj7i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0C9A21D67D5; Fri, 15 Apr 2022 18:23:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347322AbiDNWtu (ORCPT + 99 others); Thu, 14 Apr 2022 18:49:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347308AbiDNWtl (ORCPT ); Thu, 14 Apr 2022 18:49:41 -0400 Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4BC6C8BEF; 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?Q?Bj=C3=B6rn_T=C3=B6pel?= , 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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) =09while (next_to_try < nr_cpus) { =09=09CPU_ZERO(&cpuset); -=09=09CPU_SET(next_to_try++, &cpuset); +=09=09CPU_SET(next_to_try, &cpuset); +=09=09next_to_try++; =09=09if (!sched_setaffinity(pid, sizeof(cpuset), &cpuset)) =09=09=09break; =09} -- 2.35.2