Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1392805rwb; Thu, 1 Dec 2022 17:05:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf4cl+PUdN5XyISBHV6t3xiWmYKcl5blVWYrR8zZ6Fj5IMFexE7TJHhCKgnnvIritqd7L+vl X-Received: by 2002:a05:6402:f1c:b0:46a:b1a9:c34e with SMTP id i28-20020a0564020f1c00b0046ab1a9c34emr4721379eda.212.1669943108766; Thu, 01 Dec 2022 17:05:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669943108; cv=none; d=google.com; s=arc-20160816; b=KUnoimRVBwzWPrzFh7ULdhXUHbWdkGlVv8EEAASPzXWI/G/gNcUWCpllyMgU51y+rr wzcoJco2kMTWlHJW4Et50878sP/dSi51ZUNyDSvgwOlPwPx5diBydZ62M9iU4aNKp2J4 wiy8eklc7EtB/ncGG3OnShWuPqSEPyG7cVZzTOIjtTll8vVsceJyWPFl5CvGEXaFbNiA qoxU/NTlzA30mpVkLL6WeQHhISc3Lji7gpqyCBYdSG5NApda85sxJMzS/32SLkikiwHG xT+eMe7I7ZB4nJTtbc7sX4SRWzTqfWUF1glOJs9BDsjaB6as5Z84gUpSmcIe+ceK7YU4 bezQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Tg48tuWS75RG4EGpWvYE/NpwbAAmMt5D2QrvouYOgx8=; b=BIGze/fncLDA4kF+qVa24d3zHlOHWZYbVwGvNZrWjwVpeKPrM267JyaQpCCQ0Z+N7/ SF84KKRL8zyCvl6sdFeouWSQGcckmYhB5z1m/0//AA3b6od7xe/+kR9Oc8DmBVsHekXf HSMJ9S2bPTS6td9b2ftWaq5hwV76NuppiBGL9z8ZiV4GEgF5xBDfnDz41aPWQK9yTp2t Gkwd8iAZlsXZETW0qSFFLWvP3avtwITe5fsygST5IUjXpVYXCCaXs5ckwtzWF7vphqWl 5Bd75CdtnAODja1rkOMOuFFTcXJb8xdYigDhI1cNzzlokUMVanj0aZTBhMzlfUPWyw/8 7IEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Qzp+wvhF; 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 mp6-20020a1709071b0600b007ae24f28400si5338931ejc.247.2022.12.01.17.04.49; Thu, 01 Dec 2022 17:05:08 -0800 (PST) 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=@ziepe.ca header.s=google header.b=Qzp+wvhF; 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 S231515AbiLBAqS (ORCPT + 81 others); Thu, 1 Dec 2022 19:46:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbiLBAqP (ORCPT ); Thu, 1 Dec 2022 19:46:15 -0500 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B27D5A1A07 for ; Thu, 1 Dec 2022 16:46:14 -0800 (PST) Received: by mail-qt1-x82e.google.com with SMTP id h16so3259959qtu.2 for ; Thu, 01 Dec 2022 16:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Tg48tuWS75RG4EGpWvYE/NpwbAAmMt5D2QrvouYOgx8=; b=Qzp+wvhFcilhPxXoaEEGw8EFjQNcZ7TaAMDrAcZbyaJ6aamI4z372SBxTcPc2Ce6nu KFUdSKFRXGWtX+SJvbHjZoAuGIoEWAy/6oJSYzZ8tGYvKY+uq7VRpTjrLHsyQD/psQ8e xvGZB6+dTz3slpQ4cS8bXXp/mHCVf9BrxyOO+hHDtL91o3AZYb8vWfB8iLr3LszXtUFU lnE7pwjO/ZVjQMNpT3h/Nhse7JDKC4h+3hC78cUBxna2f8p1HSi+rFlnYSUL2T9WevOe cvrmRBmtmfSYfJWu5nrjzgR5NLrnrgXnpWLRbVJtL1TBWQhzq8VMTN7vkeORt9MpeN5I BKMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Tg48tuWS75RG4EGpWvYE/NpwbAAmMt5D2QrvouYOgx8=; b=QsEVFOR0UgoztohXnzy/OocX8CyWC11Q8Y6BRbHFpp4S5A2PYEmgJ9PEEpWJ/Kow8R lLEY/OypNBKqGfmbU4Q2AM8j+ERfAOkMbdS0z/OFJ+GLcIWGP/t5bspBTcGqfvW8sLxr rFDqNVvhZDuobmPzy0ps2hEhRCVArGwnMca9obQHxWX8Kc7XcZ1sDkSCtj5od+9cAfua MBlUL589HGtVUA22lR6w6i5t2kskKKhHq4LY5YwrTJJ1VIug2h1EMZvPg38CZNgnW//s idmAuWWQtwQFk5YcjuFNMEL4bo4Yj2lCuExmXcHe4SydHbjKpVLKhverlKmV7UsAv7ji ZQXA== X-Gm-Message-State: ANoB5pkJDixU/zqOOtwljdJ/mwAUXBimE88STeufZuIZghnUfd43T3iT dOTeYt+1lbnsQkfsZ/VzmbRPvg== X-Received: by 2002:ae9:dd46:0:b0:6ce:4868:2fd6 with SMTP id r67-20020ae9dd46000000b006ce48682fd6mr45382812qkf.491.1669941973890; Thu, 01 Dec 2022 16:46:13 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-47-55-122-23.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.122.23]) by smtp.gmail.com with ESMTPSA id t3-20020a05620a450300b006eea4b5abcesm4765861qkp.89.2022.12.01.16.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 16:46:12 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1p0uBw-001yp6-1e; Thu, 01 Dec 2022 20:46:12 -0400 Date: Thu, 1 Dec 2022 20:46:12 -0400 From: Jason Gunthorpe To: Andy Shevchenko Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Matthew Wilcox , Sakari Ailus , "Rafael J. Wysocki" Subject: Re: [PATCH 1/4] container_of: add container_of_const() that preserves const-ness of the pointer Message-ID: References: <20221201193057.1195255-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 On Fri, Dec 02, 2022 at 12:50:05AM +0200, Andy Shevchenko wrote: > On Thu, Dec 01, 2022 at 08:30:54PM +0100, Greg Kroah-Hartman wrote: > > container_of does not preserve the const-ness of a pointer that is > > passed into it, which can cause C code that passes in a const pointer to > > get a pointer back that is not const and then scribble all over the data > > in it. To prevent this, container_of_const() will preserve the const > > status of the pointer passed into it using the newly available _Generic() > > method. > > > > Co-developed-by: Jason Gunthorpe > > I believe this tag requires SoB of the co-develper. Sure, Greg you can add whatever tags are required Did you look at possibly just calling this "container_of" ? Thanks, Jason