From mboxrd@z Thu Jan 1 00:00:00 1970 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 48F69C433EF for ; Sun, 10 Jul 2022 20:19:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229570AbiGJUTK (ORCPT ); Sun, 10 Jul 2022 16:19:10 -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-Google-Smtp-Source: AGRyM1sN+yMDd9eMlY/wC+lb+z5dP2YfafkBCnRXR4CiepxY34tTWOLWn1G0hHHRtHX0158SS/jnSQ== 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 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