Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp805312pxp; Fri, 11 Mar 2022 15:37:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWUEvpGs+SH2F7xf3sM3cEgWHZNevhDGGe4+d5sRSowBIK5VKwS3BpBfVlLJw9Y7EyPCY2 X-Received: by 2002:a17:90a:2b88:b0:1bf:5252:3afd with SMTP id u8-20020a17090a2b8800b001bf52523afdmr24120377pjd.92.1647041851991; Fri, 11 Mar 2022 15:37:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647041851; cv=none; d=google.com; s=arc-20160816; b=WagRPEejR5Oa9kwTFVntkZuA9rfOGNGn7Czax++2DOM+UGgjdkpnbhrAnv37NJaBZi gopBpEqD3VoWC2mH5KYzEvebrIvWTILGhszZilIXyVmnzJ8C9q9D5FdW1dCJfixPk5p0 XoSKhTK3vTWUYLxG+c8xNT3pM2rZ/bNbA6VL2Yoa+3CIDV0XV7IDbAhfN0Y5mKqMdj3k Ku+eZ6wK+R4p0uUOGZR9zAdZ84FrTGzKNUmxnB7M26Q8lvQaEhx6ru2L0Q2zu19o0q1i j++tHURjBrO8CFQvSHTX0CRu6kZXKwM3RJ5da6QVTa4dtGtTOXZMbuqK6tWqswHObJAx /ZSg== 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=l1bduWvt/CdjWmQkkyuVKI1SoQtj7OXve0HQvrvs5/I=; b=VLYNaiw2t2M8xumCQHmEmB3IyUj0Ie1Prnaq7BhrMh2cPiph6YBFq5/5KKGUr2Q2TG d6UzM9MLd3s0ANFegXBBr2Fgo46kNOSBohjmXJZhH85kkIGwj4X3hrwtMxnbm025Tn+w YmdIVvz9Sl4/yhdCqK3ZnWGPeejmAH+A8GGYFneZf+C54MbwGs1rnDmvQoJ5N8oSxg+O ZvSl4Po8lr7tR+9Y0aEQ/hmNfgwVApBNE+SF0/SIB4F/QmqOwKCP9YZYjn4SycLfRk7P SDRTl/jNkTTj1vKiJYE5JKFndHOdCp7JXwSjdpgin1DHijYIXuvyYyChIUU9KodquBEm 5JuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b="ia3xAS/M"; 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=protonmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n3-20020a170902d2c300b00151ef69c29esi10317065plc.49.2022.03.11.15.37.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 15:37:31 -0800 (PST) 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=@protonmail.com header.s=protonmail3 header.b="ia3xAS/M"; 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=protonmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6FFEDA994D; Fri, 11 Mar 2022 14:49:16 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbiCKWtv (ORCPT + 99 others); Fri, 11 Mar 2022 17:49:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbiCKWt2 (ORCPT ); Fri, 11 Mar 2022 17:49:28 -0500 Received: from mail-4327.protonmail.ch (mail-4327.protonmail.ch [185.70.43.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA612270F35 for ; Fri, 11 Mar 2022 14:23:33 -0800 (PST) Received: from mail-0301.mail-europe.com (mail-0301.mail-europe.com [188.165.51.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by mail-4321.protonmail.ch (Postfix) with ESMTPS id 4KFgJC1Bh3z4xCgB for ; Fri, 11 Mar 2022 22:16:27 +0000 (UTC) Authentication-Results: mail-4321.protonmail.ch; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="ia3xAS/M" Date: Fri, 11 Mar 2022 22:15:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1647036926; bh=l1bduWvt/CdjWmQkkyuVKI1SoQtj7OXve0HQvrvs5/I=; 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=ia3xAS/MfhjG1g4DtW5kietXkDif1bYn6Fj5JolIS+zh4xESPcxMEwY/51H0a+qlM oRm8++EThWrl6Vc3pFP6aqX2pOUY42Zp9Vqmln3KzGvv8gafBfXI32+dBUKiy5RAFB MyaopiD41Zc1yKB/Buk9LdFJXljwkrh1JoVHAEABX6yq6Ms/OWL5J1WAx5pFzZt6WX 5yxVU4xsBrF/j+1ykUQXys7AdMtpHh9D7LVSnQXadLIBofAtM2FYqUnk4CV5t4KoEI bwEtuj6o2BtLiCpEX8xrcmXaX3APS8O7lcOwpdEq5RVhUzudXkeYNEthMX3Sv8ILXm pqrvM46WvX2hA== To: Linus Torvalds From: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= Cc: Linux Kernel Mailing List , Greg Kroah-Hartman , Andrew Morton , Xiaomeng Tong , Kees Cook , Jakob Koschel , Arnd Bergmann Reply-To: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= Subject: Re: [RFC PATCH v1 1/2] list: add type-safer list_head wrapper Message-ID: <1D4riYxukWActDG6uXJOjvSq0GvTWaO4KZGVfqmX5RG_HGGjzgBb3srCUNRZqyPOzzNzVIrKRw0ktupkVs0DWQGTiZ1cSuWEcu5z3O1Pk4Y=@protonmail.com> In-Reply-To: References: <20220311013238.3387227-1-pobrn@protonmail.com> <20220311013238.3387227-2-pobrn@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 Hi 2022. m=C3=A1rcius 11., p=C3=A9ntek 6:06 keltez=C3=A9ssel, Linus Torvalds = =C3=ADrta: > On Thu, Mar 10, 2022 at 6:49 PM Barnab=C3=A1s P=C5=91cze wrote: > > > > That is indeed a simpler thing to do, and doesn't need `offsetof()` at = the > > declaration, but there are places - not many - where the `list_head` m= ember > > is inside a subobject, for example, so `member` now contains a period. > > Ahh, very true. And very annoying. So close, yet so far, and no way I > can see to really deal with that. > > And it's not even really all that rare. It may not be the _common_ > case, but it's still fairly wide-spread and not some "one or two odd > places" thing. > > This grep catches at least a subset of cases: > > git grep '\ > and it's clearly all over. > > As mentioned, I don't think that we have had huge problems with > getting the member name wrong. We do get a fair amount of checking in > that it obviously has to be part of the type we iterate over, and even > if you were to pick the wrong one, the result is a very simple "that > doesn't work". > > But it would still undeniably be very nice to have some automatic > build-time checking for it. > Yes, I think compile-time errors are significantly better than whatever you= get at runtime. So, sorry to be this obtuse, but I gather the proposed interfac= e is a no-go in all ways, shapes, and forms in your eyes? I am fully aware th= at it does not magically solve everything and it does not work in the "interestin= g" and "convoluted" cases, but as mentioned in a previous email, I think there= are still a lot of "boring" places where it can be used. But of course I don't = want to bother anyone if it's a definitive no. > [...] Regards, Barnab=C3=A1s P=C5=91cze