Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1996738rwd; Fri, 2 Jun 2023 03:22:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PZ+1yBhzV2xsc8FRVQ0/GnFYfvY4v0eMNluYeeqBByiqT51werZFvV/BzX46sGN+gF8Wu X-Received: by 2002:a92:dc51:0:b0:331:53ee:921d with SMTP id x17-20020a92dc51000000b0033153ee921dmr8486183ilq.25.1685701367253; Fri, 02 Jun 2023 03:22:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685701367; cv=none; d=google.com; s=arc-20160816; b=guijvzrK4QrxtNgghWWSaK0z7WenVkYN0g28lKxxeaxo44o4hKPFu+PEXkAu0YEpIV uMoxFdDRlkljZlkpVadPUfkwBEz+r7LwqtFAErz2F8hi65dwA3xyy7R7R/qRZjnfdBjR mSM60CoIhskpegyRlU3AYgAC2eScaxHOIfrd5KE8Qo4ZQQ4UYOHXQ+KkoHNGVVz1QBVU a8hdLM7GPA65NXtjlvxxUZMkmrKjkr5L9o2GnFmTREqQQ5WYVROPURz06Bx0nWptz2aH /vbPceRBeRyEj8SYOmlgOhhSEzO3rtblV0urD4PCzgRxcilPFn9j7S7aHXqy06R0sMl/ NcFQ== 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:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=YMh8Ybc8ZUhmFobAF8M2OSS9v8d0UX2pSUgXc6DqSNY=; b=BGilzHqp5zYzHGUtkpQHhP4fm7WYInpV60DhyW/ODXb2dmStTbUqSTQAI4/NKYB393 J5BzK6m6L6ijsrca1ur3utdr66FIWCFbj/sXUR1g1yTlIKJ6haW5JGwWvQW6r+ILqBop YwjMRj6CDoKq1fY9CD6IlVWrLtPgv50V0XP4GC2VpRrcAOAYAtvC7dc5NLLT35Srcwtx yZuW5x0WbK1P4zsLxKVlcHH82a0pV/SvB8WZJ/P+cIp8t0bRPutUKaQfIyjQfr86W0GJ GU54Qg0yO2ZOfYr/ITpy0dj9o7BVLCteKn430whHw19KhNcxpDKKLEf+gMOr3ZjH9nET Wg7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=FpZ2uz9p; 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 e12-20020a65688c000000b0053efd751392si759588pgt.827.2023.06.02.03.22.34; Fri, 02 Jun 2023 03:22:47 -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=FpZ2uz9p; 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 S234831AbjFBKIO (ORCPT + 99 others); Fri, 2 Jun 2023 06:08:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234014AbjFBKIM (ORCPT ); Fri, 2 Jun 2023 06:08:12 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BA04E7 for ; Fri, 2 Jun 2023 03:08:11 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230602100809euoutp025fa6c1c074e29a14a8dd371de06b6ac1~kz6oGeNKO3160631606euoutp02i for ; Fri, 2 Jun 2023 10:08:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230602100809euoutp025fa6c1c074e29a14a8dd371de06b6ac1~kz6oGeNKO3160631606euoutp02i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1685700489; bh=YMh8Ybc8ZUhmFobAF8M2OSS9v8d0UX2pSUgXc6DqSNY=; h=From:To:CC:Subject:Date:References:From; b=FpZ2uz9p7xrKGDBdWYA84As+YaBBdVQj+LlfIX53ZlrKEgCCZrOK65ABxTBqm0TV6 d1eRzdvA+x7Tf9mmZw8qHKSbqhrTqPqY1/kd2xm8GbAjF3rFLVaTCNe2GCBdm7kTze LtDnqpgkC4aHQbjqlgfI5Z89vVH26z73SMcm5m6w= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230602100809eucas1p204242a767a6ae83c3e61eb9ae3ba99eb~kz6oAp1oC0507505075eucas1p2U; Fri, 2 Jun 2023 10:08:09 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AE.25.37758.98FB9746; Fri, 2 Jun 2023 11:08:09 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230602100809eucas1p2c8bb96fb0de40a0f38ab28611246f95c~kz6nt6e6D1573015730eucas1p2w; Fri, 2 Jun 2023 10:08:09 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230602100809eusmtrp1765fdb334f9cc2a9e47219413270d330~kz6ntbXBx1803818038eusmtrp1F; Fri, 2 Jun 2023 10:08:09 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-2d-6479bf898be1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 29.34.14344.98FB9746; Fri, 2 Jun 2023 11:08:09 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230602100809eusmtip286e1106ead142a78db2efe8dde0e6c6b~kz6nfJWms0046600466eusmtip2L; Fri, 2 Jun 2023 10:08:09 +0000 (GMT) Received: from localhost (106.210.248.205) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 2 Jun 2023 11:08:08 +0100 From: Joel Granados To: CC: , , , Joel Granados Subject: [PATCH 0/8] Remove child from struct ctl_table Date: Fri, 2 Jun 2023 12:07:57 +0200 Message-ID: <20230602100805.777917-1-j.granados@samsung.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [106.210.248.205] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCIsWRmVeSWpSXmKPExsWy7djP87qd+ytTDHpWKljs2XuSxeLyrjls FtPvvGezuDHhKaMDi8emVZ1sHp83yQUwRXHZpKTmZJalFunbJXBlHDuznL1gqVDFnSWH2BoY Z/F1MXJySAiYSOy+8YO9i5GLQ0hgBaNE/7otjBDOF0aJHS23mSGcz4wSTbdOs8O0PGrewAZi CwksZ5T4clcZrqht+Qyo9i2MEhv+TGMFqWIT0JE4/+YOM4gtIiAuceL0ZkYQm1lgAqPErEMc ILawgLnE88t7WLoYOThYBFQk1k6MAAnzCthIXFncwwSxWF6i7fp0Roi4oMTJmU9YIMbISzRv nc0MYUtIHHzxghmiXlliwrrfrBB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 2q5PZ4SIC0qcnPmEBWKMvETz1tnMELaExMEXL5gh6pUlJqz7DXVorcTnv88YJzAKzULSPgtJ +ywk7QsYmVcxiqSWFuem5xYb6RUn5haX5qXrJefnbmIERsi2Yz+37GBc+eqj3iFGJg7GQ4wS HMxKIrxCYeUpQrwpiZVVqUX58UWlOanFhxhNgd6ZyCwlmpwPjNG8knhDMwNTQxMzSwNTSzNj JXFez4KORCGB9MSS1OzU1ILUIpg+Jg5OqQYm9/v/TOt/VSsKO3xgzWrdfkOnMLi6JUF9ip9z mOnlp5NVuJveHUg8EsP9/+nKzDe/1qyfckFz5ebFrFPv7zT6Zn5Lx9xfuen6zJVzPHuuTi7i OXcoeG7oGwWFF61faqf/PslbUbXq+8Izk+f8P9bfL/b6ZdTzD3d3TxRqFG4oWCjz8aW9FMvD k3eUrU+wFD/eNeHWv/CFT7LLr5dkft6tsMlSlann82LnWdxf9gTX3Frx5fX7RrMp/celnpYt bfqUaPN2S+eD7ufrxcQYhf0KOPL+uSQI7dWYaTohj7NPelPzbveXq7xXfMk5dnLqLN0tfOmn uN+LunLHz/2VU/l+F6dl98lOo4MHXGI3icdeXarEUpyRaKjFXFScCABFnWLEGQMAAA== X-CMS-MailID: 20230602100809eucas1p2c8bb96fb0de40a0f38ab28611246f95c X-Msg-Generator: CA X-RootMTR: 20230602100809eucas1p2c8bb96fb0de40a0f38ab28611246f95c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230602100809eucas1p2c8bb96fb0de40a0f38ab28611246f95c References: X-Spam-Status: No, score=-7.3 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 This is part of the effort to remove the empty element of the ctl_table structures (used to calculate size) and replace it with an ARRAY_SIZE call. By replacing the child element in struct ctl_table with a flags element we make sure that there are no forward recursions on child nodes and therefore set ourselves up for just using an ARRAY_SIZE. We also added some self tests to make sure that we do not break anything. Patchset is separated in 4: parport fixes, selftests fixes, selftests additions and replacement of child element. Tested everything with sysctl self tests and everything seems "ok". 1. parport fixes: @mcgrof: this is related to my previous series and it plugs a sysct table leak in the parport driver. Please tell me if you want me to repost the parport series with this one stiched in. 2. Selftests fixes: Remove the prefixed zeros when passing a awk field to the awk print command because it was causing $0009 to be interpreted as $0. Replaced continue with return in sysctl.sh(test_case) so the test actually gets skipped. The skip decision is now in sysctl.sh(skip_test). 3. Selftest additions: New test to confirm that unregister actually removes targets. New test to confirm that permanently empty targets are indeed created and that no other targets can be created "on top". 4. Replaced the child pointer in struct ctl_table with a u8 flag. The flag is used to differentiate between permanently empty targets and non-empty ones. Comments/feedback greatly appreciated Best Joel Joel Granados (8): parport: plug a sysctl register leak test_sysctl: Fix test metadata getters test_sysctl: Group node sysctl test under one func test_sysctl: Add an unregister sysctl test test_sysctl: Add an option to prevent test skip test_sysclt: Test for registering a mount point sysctl: Remove debugging dump_stack sysctl: replace child with a flags var drivers/parport/procfs.c | 23 ++--- fs/proc/proc_sysctl.c | 82 ++++------------ include/linux/sysctl.h | 4 +- lib/test_sysctl.c | 91 ++++++++++++++++-- tools/testing/selftests/sysctl/sysctl.sh | 115 +++++++++++++++++------ 5 files changed, 204 insertions(+), 111 deletions(-) -- 2.30.2