Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp124757pxa; Wed, 26 Aug 2020 19:33:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+euUBu1yKrjTS/P1HYa2qPxY3drSJy3OAeAcosya5rX5P52ho3KW4WHIc2T+Zogbu0HuP X-Received: by 2002:a50:b2a5:: with SMTP id p34mr5409948edd.385.1598495632995; Wed, 26 Aug 2020 19:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598495632; cv=none; d=google.com; s=arc-20160816; b=WbS93DXUYsjNXIuDtL3uPd9Ek2AADSIbYZV9t/uJBGDqf3X1h8RhepJCV+aJo2fxh2 Ol5S+V7yz4u8ax3AI6+V2sphi23lwsgkzMOef0CcrgTGXbhsnwok2x2Bx8IRUzhZpDcm GUkTHlZrB1NviCRYDYWBa7zb4WUR5cL2e7ENadVG7fGSLwU5Yjn7VdUIR81e1kJdq9Tg s3yOyAyyGoFGID8op8Ri1PZYbWtbi4Gdl2lbempavJByzQ5HCMbtBHFMVyxNsXgpB5El xaDrwa7MlQ9OkyPRP6uDOsoFYS1wDrjBjpP4qgr4ZaF2/nLFG7ZIMGdF1F+HxZEtRMGF OhvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=49yMxH6diGPmKrZzMb69pa6ebAiIJKOxRAHVKeFG8KQ=; b=oI/idDU9iFGqj2v0mFC4c4LGvrhMRLFe8xTEZJZbV9EnYlU3gg/kzTV9h3VgDM/e0Y 4gS36uTFajINP2u8Oxppjb3REY/yYvVEWZ+1aNO3+OG8zn8no5pRrwK59Yb02BN18jOo +it7xcN90fLKn/ItposF/w26r60tX4CXzdk9nyvkekV8k8+xZstrm+w1tw6bTYqGRsyh J1nJwr5XePb3YNk2R6S36YSsHSdvYBkRCbAh0nHMKfMKZT13sdUkbA9hpGcYHU7Mh1Zt xNdxU559HECWKGSak27TDSZ/rOwXVqLcpxLURniVYtWTY9SX1OqRoh6EV0ddMG6VTJEe Yd1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nzua3Ghu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg17si626872edb.397.2020.08.26.19.33.01; Wed, 26 Aug 2020 19:33:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nzua3Ghu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726936AbgH0Cbn (ORCPT + 99 others); Wed, 26 Aug 2020 22:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbgH0Cbm (ORCPT ); Wed, 26 Aug 2020 22:31:42 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE72CC0612A0 for ; Wed, 26 Aug 2020 19:31:42 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id t9so2298710pfq.8 for ; Wed, 26 Aug 2020 19:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=49yMxH6diGPmKrZzMb69pa6ebAiIJKOxRAHVKeFG8KQ=; b=nzua3Ghu75BXNzDuPG/7vO5dh7uJ+wvamCkqYZ6Fq6grznw9z+7sTkMwkDTQuOT4mj RL4aM32wQphKxz3CI7fWgU/sart6GTa+UHZsfHuRlXDTaKiz1klAf9DBh311fRqDgxuK 96mOy2VPdz9/2Dr6Pfmy2OeA9ggwAP3xrxVRQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=49yMxH6diGPmKrZzMb69pa6ebAiIJKOxRAHVKeFG8KQ=; b=HfVj0S8chr2va9ZTgIqM6NxqteRYyQcoQg31Jks3K5d0UX4lpKlMUqv4BWW4ANxcUw 4ojNoGtb7Ef3Td5LSzubSfRFoePpyH89Yzb7bltZXkBJY30bbJsMghgsmBqfjKhJghN8 TfUSlEsaxMF2xJ7zCE+yB2aCbfgA899g+Ld8jmWV316OwVItxS5iOubjc4xCtEgItd7S wKrRXLtMl5ods5mIu06nDKi4d6HQue185qAKotXy0V8Fa9jYiIyaoUW0Qw2XyDgUxBTQ D7tmsg7P0fVaYR2NoN/3AHcTdPXaUn+giqAvcW42Z3H3dkikhtZjj5avpMnn21xxoW50 GJmw== X-Gm-Message-State: AOAM5323CUQ4YXFDpfZoVa1A3WiXHTr80hPG4Qg86ZqB7bekSi/O8PGJ eN8s4fkI0tdNoEwyPxJ5xHcwNw== X-Received: by 2002:a63:9a41:: with SMTP id e1mr10278787pgo.183.1598495502091; Wed, 26 Aug 2020 19:31:42 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a1sm586212pfd.65.2020.08.26.19.31.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 19:31:41 -0700 (PDT) Date: Wed, 26 Aug 2020 19:31:40 -0700 From: Kees Cook To: Allen Pais Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, "James E . J . Bottomley" , Greg Kroah-Hartman , Jens Axboe Subject: Re: [PATCH] linux/kernel.h: add container_from() Message-ID: <202008261929.A50D0DB3E8@keescook> References: <20200827013636.149307-1-allen.lkml@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200827013636.149307-1-allen.lkml@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 27, 2020 at 07:06:36AM +0530, Allen Pais wrote: > Introduce container_from() as a generic helper instead of > sub-systems defining a private from_* API > (Eg: from_tasklets recently introduced in > 12cc923f1ccc: Tasklet: Introduce new initialization API) > > The helper is similar to container_of() in argument order > with the difference of naming the containing structure instead > of having to specify its type. > > Suggested-by: James E.J. Bottomley > Suggested-by: Greg Kroah-Hartman > Suggested-by: Jens Axboe > Signed-off-by: Allen Pais Acked-by: Kees Cook Who can carry this so it can get used by multiple trees? Should I keep a git branch folks should merge when taking Allen's conversion patches? (In the future we can do a treewide replacement of the subsystem-specific from*() macros into container_from()) Thanks! -- Kees Cook