Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1160253rwb; Wed, 26 Jul 2023 08:23:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlE4hwPJQU19PTKjH0lvy+yRiWbf1ihw52DxKCsvCyrwGzfuBdFqOhKBMHr3BkKaRBr2MRM1 X-Received: by 2002:a05:6a20:551c:b0:12f:90d8:9755 with SMTP id ko28-20020a056a20551c00b0012f90d89755mr1663750pzb.15.1690385016279; Wed, 26 Jul 2023 08:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690385016; cv=none; d=google.com; s=arc-20160816; b=tnzt8cGpXx6PFAzzquv3Zx83hMbhZEJCh1YtF5vCPf9G2+HGHqk6BIRHiD6/mqJI9L X8bPn203vxlupllXZ39d2wfuK3TKhTtVxr5Dwt7Pg3Gyt7RhCR2brH9p3FssIJIZacdH 59T2Ppu7PfyN+iorbTesBynBR9SLllZk/8QYdoi9IMXA1OED26v+mtxyzNvsCkvKTJre 5Rw1i8CE9Ut3x48CBPcPlNDpiYYIWRr3HVwUpMGW139kX7YdzAA7PFWYBKZ8DkeGuS2S nDftB5E93sQr9me7bkqUvbtZwBw2CZWG/VAeHLcJ+CoSJ5sKEvshzBIYxwSnZF2XFQtk /bcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=6mB52qN+R16ZSOlZbadkP2nqRgZuKLvKv4ZQP2aLimE=; fh=jc9Oc4z2chBkB++ulkkGj5ASBtrAOk+67EQBS5BnDw0=; b=b2bBn4hT7a9I7zSceweJpBoDHNGYBdNIBi7qFocJgEHZH62RPgkGJQIc9b89qS19GX JRd5diP9KS/AjgbRJ9rOfGjKt87IikjSqsSiYMG6Z+dwKZxS7xXUtbolkUi7TvPJobI/ 58C6v75/wX8fTqaTKtAgOgEYR8zchcY5+PsrRU3omwv/XofUOAUAQMPzd56ZjMfP10J4 1gEBeeLaGMVq1kgd0cXqj7+vaPiMivfQwz0mZdm/oIN3ZLs0ecq1jJ3Fu139KgCILQIG 79eWoGnhNBpsGjWmYhRLDa3HjtuSVOgbybs7T+zrj3SNJHVpEC+JYFzqsyxHCLEi0q4r x5Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=KsHMve4E; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n127-20020a632785000000b00563f710b84esi111401pgn.93.2023.07.26.08.23.22; Wed, 26 Jul 2023 08:23:36 -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=@samsung.com header.s=mail20170921 header.b=KsHMve4E; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234163AbjGZOHV (ORCPT + 99 others); Wed, 26 Jul 2023 10:07:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234340AbjGZOHD (ORCPT ); Wed, 26 Jul 2023 10:07:03 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 482CC2723 for ; Wed, 26 Jul 2023 07:06:55 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230726140654euoutp011491006adf9d5606866156e545dea43e~1cAfUVp8U3202132021euoutp01N for ; Wed, 26 Jul 2023 14:06:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230726140654euoutp011491006adf9d5606866156e545dea43e~1cAfUVp8U3202132021euoutp01N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1690380414; bh=6mB52qN+R16ZSOlZbadkP2nqRgZuKLvKv4ZQP2aLimE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KsHMve4EUJuZI3y4V+x7wPfANifMyLnhuFBwTmSv8Tsbre8M7JjhzWs8djE7plcZR emBQvp6UDkOyyyg5mgGbp3bkvCjFczW/QSW+/a+nDyGR5UC7XuunS4kV/gJ1EiPBQM ovjo9zBf3t957JBw1tUH9lIT+GxcXKy0XKFEGOTU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230726140653eucas1p2d871c6dd058bd31fb2422dd12e6c3da0~1cAfFa4C30080000800eucas1p2b; Wed, 26 Jul 2023 14:06:53 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id FB.56.37758.D7821C46; Wed, 26 Jul 2023 15:06:53 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230726140653eucas1p2e234b7cd0af5dc506bd27399b84292a6~1cAesXzc90711407114eucas1p2V; Wed, 26 Jul 2023 14:06:53 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230726140653eusmtrp148068635e752f08c3e11322422ed43d0~1cAemxqF02391823918eusmtrp14; Wed, 26 Jul 2023 14:06:53 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-f3-64c1287d0843 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 02.C7.10549.D7821C46; Wed, 26 Jul 2023 15:06:53 +0100 (BST) Received: from localhost (unknown [106.210.248.223]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230726140653eusmtip28acb5341e8d5a00219f44de2ba1c977a~1cAedM1422279822798eusmtip2A; Wed, 26 Jul 2023 14:06:53 +0000 (GMT) From: Joel Granados To: mcgrof@kernel.org, Kees Cook , Iurii Zaikin Cc: willy@infradead.org, josh@joshtriplett.org, Joel Granados , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 03/14] sysctl: Add ctl_table_size to ctl_table_header Date: Wed, 26 Jul 2023 16:06:23 +0200 Message-Id: <20230726140635.2059334-4-j.granados@samsung.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230726140635.2059334-1-j.granados@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SfVDLcRzHfff7bfs15r5N9JHOw+ROZAmnObXjzsMPh/4R13HZtV+Ztsp+ lbjLhQwrS566HqTlaSp2VkiIwia5SmHzcNIZd0IeJgkV88vx3+vz+bzfn4fvfSlCUsD3o9QJ yYwuQamRCkTkRVtv07T0yXWq6ZU3ZfKT1zuQfKAkUX4vSyu/eq2BlLfVFAnkzv2vkPzHt990 6vKKeRRdmHGfpEusKXSleQr95G04bS3bK6CNVWWIdlvHRgijRGEqRqNOZXTBivWiDY1Pq8ik xmFpA1VmfgYyiAzIiwI8C+zGbtKARJQEmxHsqOgVcMEXBM3uz3wucCOoM+nJvxZnpZ3HFU4j uNB+btDyBoG757HQoxLgIGh+94wwIIrywevg+CGVJ03gPAQnivw9PAIvhJ6y23+akngSVHRf 4XtYjMPhtauC4IaNA70jD3nYC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s3X3awgNq+ArcSzJ2uYITbIS7Rdn84IYnMK2EmsXPsdrEYIqKZn 6lN2iHpBiZMzn4DNYQaqb946m3kCo8AsJKlZSFILGJlWMYqklhbnpucWG+oVJ+YWl+al6yXn 525iBMbJtmM/N+9gnPfqo94hRiYOxkOMEhzMSiK8hjH7UoR4UxIrq1KL8uOLSnNSiw8xmgLd PZFZSjQ5HxipeSXxhmYGpoYmZpYGppZmxkrivJ4FHYlCAumJJanZqakFqUUwfUwcnFINTCcZ /GIuexjN/dzsIB/A+uKG82Tjm02Pw5n1PFY0P3jyZGbbtuLZW0KFBYrWxwjuYPbmVc22mzF7 /Z/LcVHJsu9vGnd7+YTtifhYs/x3gkbEle0eqhdPZF8RY+T59G5x+8F0qfWrdknKrpXfdlJB qmvTwr/8HS9uODyf1BeywCTeeuO8z21/m4xKPs/Y8X3uzjj3/W/mVG2TzozZ9qyId+Ii0amW C6XPfxfLk/kw9eSd4Jdnks/cnc/hdf1oeFrDiy3flXfyGi+UYe7P9m98KfDr0mqVWouAz262 GyKDDl54OHVBU5V80YFMK8+vbMlllq7F/urrNZgMG0P/bVY61vlKPZzzq+ZthlUCM/X+flNi Kc5INNRiLipOBAChSKibHAMAAA== X-CMS-MailID: 20230726140653eucas1p2e234b7cd0af5dc506bd27399b84292a6 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20230726140653eucas1p2e234b7cd0af5dc506bd27399b84292a6 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230726140653eucas1p2e234b7cd0af5dc506bd27399b84292a6 References: <20230726140635.2059334-1-j.granados@samsung.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 The new ctl_table_size element will hold the size of the ctl_table contained in the header. This value is passed by the callers to the sysctl register infrastructure. This is a preparation commit that allows us to systematically add ctl_table_size and start using it only when it is in all the places where there is a sysctl registration. Signed-off-by: Joel Granados --- include/linux/sysctl.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 59d451f455bf..33252ad58ebe 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -159,12 +159,22 @@ struct ctl_node { struct ctl_table_header *header; }; -/* struct ctl_table_header is used to maintain dynamic lists of - struct ctl_table trees. */ +/** + * struct ctl_table_header - maintains dynamic lists of struct ctl_table trees + * @ctl_table: pointer to the first element in ctl_table array + * @ctl_table_size: number of elements pointed by @ctl_table + * @used: The entry will never be touched when equal to 0. + * @count: Upped every time something is added to @inodes and downed every time + * something is removed from inodes + * @nreg: When nreg drops to 0 the ctl_table_header will be unregistered. + * @rcu: Delays the freeing of the inode. Introduced with "unfuck proc_sysctl ->d_compare()" + * + */ struct ctl_table_header { union { struct { struct ctl_table *ctl_table; + int ctl_table_size; int used; int count; int nreg; -- 2.30.2