Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp172481rdb; Wed, 21 Feb 2024 23:09:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXq+eLov6Ee3CVOosmOPY4WWnUL212Hpe7lMGe9pHCZC7ApzkJjuGlPoSP7SR/N6H9K5N9caQ8+5AlUel/Vfov3lR+zez4+VMWFnSLh9Q== X-Google-Smtp-Source: AGHT+IGXBnbF0orHG22CB6l2M7vJm20J/aWoP1GPq6MjMF6qRp2XLt4jeudCiAQVfHt605rvIbrd X-Received: by 2002:a05:6102:370e:b0:470:4454:c40e with SMTP id s14-20020a056102370e00b004704454c40emr11429803vst.14.1708585741944; Wed, 21 Feb 2024 23:09:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708585741; cv=pass; d=google.com; s=arc-20160816; b=ddrNFXdvVg2Dp4wnRIa5eUkG6nN5Dunhpgm0yRzVNckYBltzmZrgW8Pz8tqie9uJ8G q5tMe82hJUTaOJgQ5n6UfacGuf4jjceg/GPCAUQ2jPbBg+vVoFHrYFn/10zZ2AJ6rWzn CSHQbp+7lVvfLOBBgKFdKyj7xTkJUC5KpSWYarGN0MgmPgAK3OJyE/8uoRw/AU6Zh06H eGWNk0BMNBJmPflOLMnA5fXP16SPvGQQ25YFFh/hXrf6mBv2dj+JqD+0kVULcqSQkLTM NxJg3iwbl5eUvzX3fEq12tvQQ5JrW8Pe3iQsrcuDm7D2t5oi6egPV3F0Fmm0fZ/eKDX/ +i+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=3DQfs8tb6fUy2eNOpUbx7UgpmMgt4tahxY5c7U/zAys=; fh=bv1xmQMLoUkjMaBG31+T8n2MW2r2VJMdwGgIEDt2AwQ=; b=SzXK/RW9W4SxK6oLpMjHb0TQXmN+pMowUZGXWZoYBbA33llgx80mFPvW9QseOdOznw 81UZVwKePIsKVwpfrt7dNOfbSlksFRdHeYyns/rcoN7uuM+9Sz3ww0uf4ydKlJvGuIjo 2Z7xFujQqmrrvfMoOXwYO0op2MZXBPQ+IPeD6PMPay9GnQKaUYJt56p394mIjFFfVTQL SjijZY/x1RQJ1SN+gqhC6zuXV38l4QE/EIlwxm7LhfuqNhVrcaxJflhm1p59fpD1Hhvq QUiBBPTlHxrOD+YMfyAa3oXfA3sJcICHEGdLpaLjMGweM6730Sn2wpUhIM6N73SgYspB dXug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=eqfk8toY; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-76003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76003-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c9-20020a05622a058900b0042de86dc928si12604874qtb.719.2024.02.21.23.09.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 23:09:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=eqfk8toY; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-76003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76003-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AEECE1C21510 for ; Thu, 22 Feb 2024 07:09:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40D4418050; Thu, 22 Feb 2024 07:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="eqfk8toY" Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53693F9D3; Thu, 22 Feb 2024 07:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708585706; cv=none; b=DsrkK+uf9J/ZT/bqXUVpWecxZxXd8R88fpULCeihHddkT0LE4FRaw4rq6DSXx8eDW4EDB386EUDRnwNvdX0qA1zNZpOhJ0dGvwMXJjUjfv8HUKLeyP6K6enuppqrUBZff9ZXgwg5nobi7clBGSZmYJGp1fTah9LBTYB6OcAqiRc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708585706; c=relaxed/simple; bh=rBJrdZIe+s7xK7S2lsli6LzdtB7oW9aF4vhR2l0SL8A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k4/jtX5oXZ/jBFn/BPf07DWdGEaAbYQ5873E1e6hv5NDpsNonSEKWBSZ3M9fOvSxASd2jVe6CAVxoGszizZs77BNRFCkijlS+mX69OfwjtqHJSS/PHVerBQUowwAIwSYv9G68ZyTMjXtwmPJLk9vFGyViLnobxsHa/KoyNrDZYw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=eqfk8toY; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1708585697; bh=rBJrdZIe+s7xK7S2lsli6LzdtB7oW9aF4vhR2l0SL8A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=eqfk8toY1el32V/MPrbxgEpdTa0Hpy3mTXhGrT8zRUU/8yQPnZvswvVrDEUBNx/PA w9IXJ5hf+IFzgQ4levuO2YB4QCgEosLFzsLl63iohcoE2ZdFwJtL7+e4LYJXTYoJ/8 3RT8r+5HyD9xc45EQBk1Ms4OT8KNlLXROChzhucE= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 22 Feb 2024 08:07:36 +0100 Subject: [PATCH 1/4] sysctl: drop sysctl_is_perm_empty_ctl_table Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240222-sysctl-empty-dir-v1-1-45ba9a6352e8@weissschuh.net> References: <20240222-sysctl-empty-dir-v1-0-45ba9a6352e8@weissschuh.net> In-Reply-To: <20240222-sysctl-empty-dir-v1-0-45ba9a6352e8@weissschuh.net> To: "Eric W. Biederman" , Luis Chamberlain , Kees Cook , Joel Granados Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708585698; l=1782; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=rBJrdZIe+s7xK7S2lsli6LzdtB7oW9aF4vhR2l0SL8A=; b=7oyFr8FNzsmBv8BO9h8IoLO6rz1mnJRIVR631dGxVGtdMKPzisMzyDSluUjqUgS3jCK10TR++ tx/Y8YJsER3AWg0frDqiiuSIuTyXlCdeDX8NNyuLFXS14z0mnwxQdtT X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= It is used only twice and those callers are simpler with sysctl_is_perm_empty_ctl_header(). So use this sibling function. Signed-off-by: Thomas Weißschuh --- fs/proc/proc_sysctl.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 37cde0efee57..2f4d4329d83d 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) /* Am I creating a permanently empty directory? */ if (header->ctl_table_size > 0 && - sysctl_is_perm_empty_ctl_table(header->ctl_table)) { + sysctl_is_perm_empty_ctl_header(header)) { if (!RB_EMPTY_ROOT(&dir->root)) return -EINVAL; sysctl_set_perm_empty_ctl_header(dir_h); @@ -1204,7 +1202,7 @@ static bool get_links(struct ctl_dir *dir, struct ctl_table *entry, *link; if (header->ctl_table_size == 0 || - sysctl_is_perm_empty_ctl_table(header->ctl_table)) + sysctl_is_perm_empty_ctl_header(header)) return true; /* Are there links available for every entry in table? */ -- 2.43.2