Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp846869pxb; Fri, 22 Apr 2022 12:28:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhX0B38rlhULVXLw8bPAmqa/pxWGJVCgV8Ma1pDB8jBjtZcGIHI8Nvf8F39GNunDE6tzp5 X-Received: by 2002:a17:90a:5b09:b0:1cd:b3d3:a3f3 with SMTP id o9-20020a17090a5b0900b001cdb3d3a3f3mr7144996pji.9.1650655712939; Fri, 22 Apr 2022 12:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650655712; cv=none; d=google.com; s=arc-20160816; b=tRm8o4ilX+J9UVL6axajuKsYilWJtUa9M22hTRU+HQDm7feVecpz4xFIWkB9ORwv+I SmbZm+65JBD8TkY4J/gqBJheOh2BN4qMUm/hoNbfIBGqpVn4SHcdZjvqCrGpGEP+ijjq 4RqK43ptH2l0q5F9AmpQfQkkoq4PKBlAaKqvk+d7sXtRm8QVMkH8xMRjyYu3OAbz649O UrHxnazMmzs8/jB1ayD55NAIWAA9g8v3kzqeW0MyLNUzHRqUB0k6rnYIhC9WqIXYIl+a VSQnWyjlJEyZ+kan/rjn55HcqdjOlFzfzpsIu4akOVCnq9rfL9fw1PuL3V+C4hGLLgP3 BLhQ== 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 :feedback-id:references:in-reply-to:message-id:subject:reply-to:cc :from:to:dkim-signature:date; bh=cRAvzrtALX1sJ8J18VhyO/LgCTRMCMTwVnkRTlhgHHY=; b=BKKdy6aGGYic5nXHYU8qfyL/I/Om6GbG5iNtUohNgGp7fy/uKJK1IQM3Z9JXIuUC4B 1zbQAd8E+8bEwUY4+weyeu0jmK0j0wi6oLRn3LCpfvsKCUEUatJ1h0gCnroibEtzoHyA r+iAnGATEdhhGj5wDN9vpVt7vpTuWPTDatP7mp6TwzvfeYN3E1Kxl0L2939XzCQNw3ae 0ON5xPpv29yrwYhUxpBULZXW1A1yOHXV+j5cvImmJmRvhATTAQifOxFsT3e424KzOAH+ AJFo6Gr5br63nL5tJxl73wUxgQal/rgCG3XqKStaAoDifAhEHyeqO5QvWuu092SGwBcu cYOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail2 header.b=bN7ztdhb; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c15-20020a170902b68f00b001568126be52si8644635pls.605.2022.04.22.12.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:28:32 -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=@pm.me header.s=protonmail2 header.b=bN7ztdhb; 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=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 D9CDB1D70E5; Fri, 22 Apr 2022 11:39:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383613AbiDUAnB (ORCPT + 99 others); Wed, 20 Apr 2022 20:43:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383607AbiDUAmr (ORCPT ); Wed, 20 Apr 2022 20:42:47 -0400 Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C1BC9FD0 for ; Wed, 20 Apr 2022 17:39:58 -0700 (PDT) Date: Thu, 21 Apr 2022 00:39:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail2; t=1650501597; bh=cRAvzrtALX1sJ8J18VhyO/LgCTRMCMTwVnkRTlhgHHY=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=bN7ztdhb3R7z9ftStNO+xmJOuI0eX/7lvHTuEM2FKXprSN+QoX55kjLXacGPAQZie Q6+6KndDKQXPh6LnZRm8KXOCmmuf9lTgJ6ZSleFF6gZhhY3RIb0/mIbjYr9otNNF9e p7R9alTrgJBCQpd9NR1SsnREpEiU/TBe0kJ3DMQZ+1Ra2+hijoJWupRVJnWpByn2V2 kv2KdfVYAjzWNQr6zmnO0AQotqWT7FYitJt0NzzPIceDSobra7m+xX2DwP3+Jm0D0v IDXVWOf56J/SRdfhggn4zDph4Brp15HVph3qnyIz/4a0xZHX0444Lqz97WjDRwRmGC Vk7flGjRnNrsA== To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko From: Alexander Lobakin Cc: Alexander Lobakin , Maciej Fijalkowski , Song Liu , Kumar Kartikeya Dwivedi , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v2 bpf 10/11] samples/bpf: fix -Wsequence-point Message-ID: <20220421003152.339542-11-alobakin@pm.me> In-Reply-To: <20220421003152.339542-1-alobakin@pm.me> References: <20220421003152.339542-1-alobakin@pm.me> Feedback-ID: 22809121:user:proton 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 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); | ^ Macros must always define local copies of arguments to avoid reusing, but since several libc versions already and still have that, split the sentence into two standalone operations to fix this. Fixes: 5db58faf989f ("bpf: Add tests for the LRU bpf_htab") Acked-by: Song Liu 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 75e877853596..d09ccd5370e8 100644 --- a/samples/bpf/test_lru_dist.c +++ b/samples/bpf/test_lru_dist.c @@ -230,7 +230,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.36.0