Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2713405imw; Sun, 10 Jul 2022 13:23:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uLg2B5e2cey1I7uyZXpgU+DRd+ZVQgB2S+C0ncFW9Nac60ChqiDW76J5sXxqHi0Knq/myg X-Received: by 2002:a05:6402:5189:b0:43a:c55c:cf00 with SMTP id q9-20020a056402518900b0043ac55ccf00mr10195089edd.390.1657484606805; Sun, 10 Jul 2022 13:23:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657484606; cv=none; d=google.com; s=arc-20160816; b=XN4bOT2hnVWQBhpQw+4IcebJCpRNotDnMfGZzRYuKGzc1I0/XCb2frao/edOCY2za5 78gyq1sdmLQH5itL1aC/yvP8YisO7sou1vBw4Z+R5UivwPEMbOQDH/G9DM/rt89zSctv IZ+q2E/Q54PZpseZjklkbcd36dTlsgWkaHSZvbTFlyTEg0AYQVC3dDS5Xsa/LhQQbSPL 0M4LACEfDT9QpPw38ne0kH9C6p1qV07LtAjiXSK9xBFCmXmaIw1fILaESpimsOmzvQsy IR/7lDTx5FuV4s2WKZ+a7SnTBpoahPTIiqtlQr97R+0FffLnrCurlAUwWpSSFIAEra2T kx8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=2dNNm+2Z7DDTrnInVJhwVhx6QVDRUW2xps/sEbVOHiU=; b=WTX6D9/N5KzZkoNb5pRSOumuuaHo6zYqMTiXdNt8h97SboaUC0yTL4tgtokB3xQp+U 8GBLmWX6yiQTS39V7lDS0eDfWGPnCk9GJ3Or+oPkZCS9rx8YhfwBoSK7RhTHx4swx1hO 1bUEtIjSCunhKsitcAvi1sxHDC3AdN3da4ml7JSTS3BAqXNeYyxgHkrF7EqAQud1guHs bFRCpwnIIuzBJVvDVmxVo/wXEN/vdnCFjPEsmrc0fQIK1o1X2hBCgbyQ8jxkxEcbPMo3 /5PhlJX2R6BHwptUvMqzCRuEU3Hh8l/sq9d4mGI0ahEfu/4C0V/O8mIzIgM+AHSjdu2D +c7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=Dwui2oCy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a73-20020a509ecf000000b0043a6e52f68dsi8091223edf.502.2022.07.10.13.23.02; Sun, 10 Jul 2022 13:23:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=Dwui2oCy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbiGJUTJ (ORCPT + 99 others); Sun, 10 Jul 2022 16:19:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiGJUTI (ORCPT ); Sun, 10 Jul 2022 16:19:08 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E209911C2C for ; Sun, 10 Jul 2022 13:19:06 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id h23so5658057ejj.12 for ; Sun, 10 Jul 2022 13:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=2dNNm+2Z7DDTrnInVJhwVhx6QVDRUW2xps/sEbVOHiU=; b=Dwui2oCyaMCi3tSvwOpjfJZZGOdnlgOydmP1frvpBNLn1BUL+tcGUAax1agMvlcYsy WUnVjcydaCNS2c83Y/M8M9fEQ0Dt/vN+P73bxohbthMchvleQX+gARGjXCQ0DPshKc+1 1Idou1dB1cCjuH6ciMb6E3eETHHFU+dp/zFOGgSIcpU4SyTmIgdke91A1zteEP58u+EU jE7frmfd6Tu97whiyPZAF5l0z0/mMCor34Z30cn9bluePt2Yiz8BhkLugKMvuB/qvprN 4v2y+6A/Li1tt9gc6GiTGggYzrjXs/Q7nANLT4zKc+MRApKm6fGZil+sGy4AWIkw5cKt 1LqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=2dNNm+2Z7DDTrnInVJhwVhx6QVDRUW2xps/sEbVOHiU=; b=AxAuqg7bspGfTATGmoyXyEaWTmcb5VBa5NEKM4gqVjg5GBTZy5hEKIMZKdm11/hxwK GX0jsCoK+v3MuErcLoNsKSiQPl7fOrhYY+kXEnGP6tTPdzuvEB3QvadWZeP8AcYBJ6zK DhEJmVU3VyTTk/em/Y+JDf2TZu/IXryrX8GktwYud0avtmCbqH7MPKL/8xQTrPuKFX9Q xqo0/BtBYRaYj3Nv3rro6d3NkQTOUKXQt4wusEQPfinfE3TRM9LJEJJuFDDmaij8W9Do qnTh5HEcBSMPVVfTMELJE01MyKVegLwjZmxO6+skPWAXpTIHO84eg77RPUZcTGYaiseS Bjhg== X-Gm-Message-State: AJIora9IQct16c6GsEXKjANgn539GWMYSl/y/p4nt5B9jLvB25z/kdB3 vabMKbgjCkbweHddqKV1XiyKfA== X-Received: by 2002:a17:906:9bdd:b0:72b:3cab:eade with SMTP id de29-20020a1709069bdd00b0072b3cabeademr7647876ejc.58.1657484345371; Sun, 10 Jul 2022 13:19:05 -0700 (PDT) Received: from ?IPV6:2a02:578:8593:1200:8f5b:bf6f:385:d647? ([2a02:578:8593:1200:8f5b:bf6f:385:d647]) by smtp.gmail.com with ESMTPSA id f8-20020a50fc88000000b0043a8286a18csm3230479edq.30.2022.07.10.13.19.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Jul 2022 13:19:04 -0700 (PDT) Message-ID: <428689f2-ad91-e1b4-64c5-c1c4802e2cbe@tessares.net> Date: Sun, 10 Jul 2022 22:19:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH bpf-next] bpf: fix 'dubious one-bit signed bitfield' warnings Content-Language: en-GB To: Yonghong Song , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Eduard Zingerman Cc: mptcp@lists.linux.dev, bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220710083523.1620722-1-matthieu.baerts@tessares.net> From: Matthieu Baerts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hi Yonghong, Thank you for the review! On 10/07/2022 18:59, Yonghong Song wrote:> On 7/10/22 1:35 AM, Matthieu Baerts wrote: >> diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h >> index 81b19669efba..2ac424641cc3 100644 >> --- a/include/linux/bpf_verifier.h >> +++ b/include/linux/bpf_verifier.h >> @@ -345,10 +345,10 @@ struct bpf_verifier_state_list { >>   }; >>     struct bpf_loop_inline_state { >> -    int initialized:1; /* set to true upon first entry */ >> -    int fit_for_inline:1; /* true if callback function is the same >> -                   * at each call and flags are always zero >> -                   */ >> +    bool initialized; /* set to true upon first entry */ >> +    bool fit_for_inline; /* true if callback function is the same >> +                  * at each call and flags are always zero >> +                  */ > > I think changing 'int' to 'unsigned' is a better alternative for > potentially adding more bitfields in the future. This is also a pattern > for many other kernel data structures. There was room, I was not sure if it would be OK but I saw 'bool' were often used in structures from this bpf_verifier.h file. I can of course switch to an unsigned one. I would have picked 'u8' when looking at the structures around but any preferences from you? 'unsigned', 'unsigned int', 'u8', 'u32'? Cheers, Matt -- Tessares | Belgium | Hybrid Access Solutions www.tessares.net