Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp56413lfe; Fri, 15 Apr 2022 19:17:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUt2tM58V18nKIC46c9iyxJ4EJ9bQZw4OABQ3VyZAaTSeYyVoPjkbF6qD8vl1TNeK4f747 X-Received: by 2002:a17:902:8341:b0:158:d083:3394 with SMTP id z1-20020a170902834100b00158d0833394mr1560757pln.62.1650075421903; Fri, 15 Apr 2022 19:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650075421; cv=none; d=google.com; s=arc-20160816; b=rKzebqw/wQtIDgtR+C++BI7Qf3MoPz6RvHDKogeROuKuF5QVBTwtnrzNlpMG5tSaC5 Esj4nV+MMiPabfs0jsdnikkW66eJTCBS3ZwQbkP/XhXTUvt18sxHBO7DsgeVssn3YuXQ Hh67NAUK1nttfbbOwfC/RrGOsi6fZ0vuAoDYwqUn3yPL2wh9qBKC4zsd1q2FUwaKF2Tg j/Um+kyPyD2has+VQDDOV89f7N3DMNKSNHDtRS4Knl/RxLyk2BYXKDnet+PKRx+z8qVD FOtYwOd1q/GW7wiOGT61zSDKqDpgozGMbXHODvb6pRUaGoSlDwe0q7AfrHA7X6/RIWOz uYcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=80UGNMCGd+XSboGkpeB0PTS1sUb/Sfy+qoaU2f7WXTM=; b=IkU2hyzGFAu37FBDqdZyyzhiLpkuzbU8t6mwb1NtzHweG1+X+L1VWY+s6JNRvu4jCl KodhzCp/gUxFEoQ2N+fG2pxC+JGc3/GiUB4dkatLNEVSO9uZdV4qN4EMJcHocpNNVDF0 /9dVe1HbVKC/8J/nhnlBj3eqUfrS6dUHex41L3kZIpa54G97+gqJkweq9EV2tLzfRZOr LEFtgixt6MWKqrjwBiRLPV+XJvH/t+7lWeHUqJs6pusmtOuGWX/wtDQYb/C+mE4kAu4Y eT8wsmJ1hFUvkBzt5MnBJDaNQUPPyoa+UpW01m8An4xoJ5LmEL26jI+oSWmRXA16P00T lGtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nZPwFrqZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k5-20020a170902c40500b00153b2d16636si3269233plk.574.2022.04.15.19.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:17:01 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nZPwFrqZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E352921FF40; Fri, 15 Apr 2022 18:32:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356651AbiDOX7L (ORCPT + 99 others); Fri, 15 Apr 2022 19:59:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238226AbiDOX7J (ORCPT ); Fri, 15 Apr 2022 19:59:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9783D29826; Fri, 15 Apr 2022 16:56:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E3776227C; Fri, 15 Apr 2022 23:56:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FB88C385A9; 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-f177.google.com with SMTP id m132so16726357ybm.4; Fri, 15 Apr 2022 16:56:37 -0700 (PDT) X-Gm-Message-State: AOAM532guazdwKo333ZAoBL5VTrfGb+tTcAqAxAtIX+aQKob464EkIqm 9rnNNYbpyHg5NPFg1hJaavNBhI+t9p441I04Ofc= 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) 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" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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 > >