Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2547731rdb; Sun, 3 Dec 2023 23:52:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkxBqt1wfCFw5qeEMTRAN82CNToRLt/ZO+T39NmDxjDJGJ2SSUPiXPTcEnu2F75ni6vyqf X-Received: by 2002:a17:902:c94e:b0:1d0:9a6b:52ab with SMTP id i14-20020a170902c94e00b001d09a6b52abmr915742pla.45.1701676363628; Sun, 03 Dec 2023 23:52:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701676363; cv=none; d=google.com; s=arc-20160816; b=0FiDLzEUudO8x28K31peYiC5IeCLZVuQw3ol3+Z5Xwdx5v6LpzxPEjtbO0W0VP3w3+ WL3hF63wVBl6eOwKB2v82QX76MFGUx+U5kZ/ke+JUlJUhQzyeRe2ew28tyrjPDPpu/mw zMY6NfTj+IInBYxcx/PzKN/2AgiJSvjbWodx85AJLqRi1W8ShqUT1Bi/JgdUzk3ux8Py Eumn+FfXmHwxOkUG52IkpFHYsjVhZJWsxSqSmmoxwCW2gjNMO8tcNhqC51jgxd0m+NRc x1L0+d/4tN90A3csvsM10ZBlGRVvnr05VEfJ/Ex6a0xzQemb+VWKkuTp9cjjELE7qDDx MV+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=pkSGwUJVAp58yayzse8J0czGWsexHEHeoX/XJW4h8DQ=; fh=1v5zqbO9sIGUc9bsdyhYE0zxdK1knZz2xnJYWUWMFKo=; b=s+T0KNz7HnIEnGoCYzja2evTeKA3/EDstmGR9stpE3AuEoZf2srQeSMHJJVoCsT5tx lY+iZnpN88rEWpJ3AB906s46sFoAhz77mZelqhzlAJ1vrVXOJQZZomzbNeo0aG1SOtmJ 1whOAshGze+Nu0lvBvAXQ033DvIQjqmqrIMnrSvPL2BMrZGEV4amnINCasl0GqyavBFc LD4eexqF06DjREchPDoCbAw+dfBnpd9fX1oFxhH8udJWOdySBwyY+y2xNa/yxmcj3fvo 4f5907TfoTMoBmHWzbp1JurhcvMZ8ZgKoPL7pbQnMZa5k5U0EJQTO4yKzxuIVUNaLwa4 +3mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=SQ4c4OJg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b23-20020a170902d89700b001d0b7902fbasi152564plz.189.2023.12.03.23.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 23:52:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=SQ4c4OJg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 478B5809ABD8; Sun, 3 Dec 2023 23:52:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343496AbjLDHw3 (ORCPT + 99 others); Mon, 4 Dec 2023 02:52:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234690AbjLDHw1 (ORCPT ); Mon, 4 Dec 2023 02:52:27 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73167F3; Sun, 3 Dec 2023 23:52:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1701676351; bh=IyP3fTXp1SAs7UkxiJUA9xlgTpZMUTTPQdr1Z8WPbb0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SQ4c4OJgJJCnisETb9hXUF5YYUf7C0UKd6c5Mww/aO3s77s0vnJ0BYmhq9jI56SXo ZOeCfh0d6Oci9O5gxeD87hctfl1w06lqiP3cEdVC5pjMtWexivDvWbYfte4WFes+8e nV0fUg21Ob0hYeGT65jveRMunFejdMDZjaDXK1Ak= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 04 Dec 2023 08:52:16 +0100 Subject: [PATCH v2 03/18] sysctl: drop sysctl_is_perm_empty_ctl_table MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231204-const-sysctl-v2-3-7a5060b11447@weissschuh.net> References: <20231204-const-sysctl-v2-0-7a5060b11447@weissschuh.net> In-Reply-To: <20231204-const-sysctl-v2-0-7a5060b11447@weissschuh.net> To: Kees Cook , "Gustavo A. R. Silva" , Luis Chamberlain , Iurii Zaikin , Greg Kroah-Hartman , Joel Granados Cc: linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701676350; l=1435; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=IyP3fTXp1SAs7UkxiJUA9xlgTpZMUTTPQdr1Z8WPbb0=; b=+ngBpUV2SiwicZA4ds9XMOzk5Pbxi+vGaZjien+LXgMroK7KKieP5OaWIcOCF+WqNuE4vgwZP xT40W0mgomqCFiuD3TvBSNW81r50LHid1h8Ji7pYWOHqATHnrdOYQdq X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 03 Dec 2023 23:52:42 -0800 (PST) It is used only once and that caller would be simpler with sysctl_is_perm_empty_ctl_header(). So use this sibling function. Signed-off-by: Thomas Weißschuh --- fs/proc/proc_sysctl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 8064ea76f80b..689a30196d0c 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -48,10 +48,8 @@ struct ctl_table_header *register_sysctl_mount_point(const char *path) } EXPORT_SYMBOL(register_sysctl_mount_point); -#define sysctl_is_perm_empty_ctl_table(tptr) \ - (tptr[0].type == SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY) #define sysctl_is_perm_empty_ctl_header(hptr) \ - (sysctl_is_perm_empty_ctl_table(hptr->ctl_table)) + (hptr->ctl_table[0].type == SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY) #define sysctl_set_perm_empty_ctl_header(hptr) \ (hptr->ctl_table[0].type = SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY) #define sysctl_clear_perm_empty_ctl_header(hptr) \ @@ -233,7 +231,7 @@ static int insert_header(struct ctl_dir *dir, struct ctl_table_header *header) return -EROFS; /* Am I creating a permanently empty directory? */ - if (sysctl_is_perm_empty_ctl_table(header->ctl_table)) { + if (sysctl_is_perm_empty_ctl_header(header)) { if (!RB_EMPTY_ROOT(&dir->root)) return -EINVAL; sysctl_set_perm_empty_ctl_header(dir_h); -- 2.43.0