From patchwork Thu Feb 22 07:07:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 204581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp78843dyb; Wed, 21 Feb 2024 23:09:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX9wJD2sn7v6RVr1r+mepyb2P58Lo+0ArxR/ui4tk8kMtVHAzG7gkW4TwGyHpSUhQNMLobwM61KrV2/vzoh30QEINCxPw== X-Google-Smtp-Source: AGHT+IG0hcB3leplNKySgoBxCQqYV5z8OjkImgCW9O451OUWJ/BCitOMcwdpiXnXh/D3Nzdj7E++ X-Received: by 2002:a05:6102:2f6:b0:471:aec1:4300 with SMTP id j22-20020a05610202f600b00471aec14300mr3378163vsj.11.1708585775120; Wed, 21 Feb 2024 23:09:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708585775; cv=pass; d=google.com; s=arc-20160816; b=fO9NzdYSCuw2gxDFKs5PlQbme8BurcQEj+v6rJeEmeRQQjXF6CL2aOGnPARvw5tuJv twJ/FCigvjpLnvSvfJ8HRRwZIYUYy+umwsP6IcKMniezu8J8AYWihR88WBMh8HeEtmaM 3UShjkuvBXYxMZLUceUNd2jnZxD/rGU477QJEG6Uvxv0t5bJ+LEnwJxCmEWvYzMHmCJd NZulyj56z3Eo8eft8b9+rb7/YSs5YIzgBGGHS7MFhRrSTYVnTQfnS51ept/uJQaVL698 wQ8hZSkKWxJCTdITcY05wYPoLCLnBCS3ZECoaGQkRfvHVkaEwG9MncJ//PKgxtin66zA g4ng== 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76003-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jt56-20020a05622aa03800b0042db60cb428si12041285qtb.576.2024.02.21.23.09.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 23:09:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76003-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76003-ouuuleilei=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 E38531C21032 for ; Thu, 22 Feb 2024 07:09:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE1A71CA8F; Thu, 22 Feb 2024 07:08:28 +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 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?T?= =?utf-8?q?homas_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= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791582037748066671 X-GMAIL-MSGID: 1791582037748066671 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? */ From patchwork Thu Feb 22 07:07:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 204582 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp79589dyb; Wed, 21 Feb 2024 23:11:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV1K0QI/eqw0vwHHnC0cJ5IR2hZC2vpQGNBX7QjXZjgXxqThdLcLvsfhz8LCXFsgqp17zwXz6iggv6fC/yfveExOGko1w== X-Google-Smtp-Source: AGHT+IE3QxRdNjkc8bfVUPTzMvnZZBSVIAvLNB4qsQFcjK5ZHH6StjipIOK7BvjfLy6hj2fU/t+p X-Received: by 2002:a17:903:41c5:b0:1db:eec6:5b87 with SMTP id u5-20020a17090341c500b001dbeec65b87mr12449084ple.12.1708585904666; Wed, 21 Feb 2024 23:11:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708585904; cv=pass; d=google.com; s=arc-20160816; b=iYtwzGh5ue9OC4boWHcShsj+Vpx7EI16KYPjkzEu1Fy6C7t/XYvJERKmeeJ/7znhD6 Z29NdJdMev3ESigPLPZfSuWPltBUGEo2SloTdvO7xJS5psXQpGVwAH7mcWum9C5KDgUQ b816a6ABEbHgElZVGtbA1cHd3klmuXX9IBPt3P/jnmZyCYzprJcA416jelEov7sOJXSV s1PMAI0ypoLTgS22liqKiRQ7uoRs+zghQHap+KCaKfCDnNKqcc18g1xMFVTG/ia6t0Q+ l5TcbCkBBPMTrwRLPo8vFAd0zFIgVZkI3St6NxtZAslRzym9TDnze6n8638AcDbxrsNm Zlxg== 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=MYyuNBdSEvSMzN+DaSMZvOv+CqYi0AfozXj0rY48gpE=; fh=bv1xmQMLoUkjMaBG31+T8n2MW2r2VJMdwGgIEDt2AwQ=; b=weqrUG8xbIe3anjVXK1/6b9CXQ6oDMTBx9VZb3xWM50YqmGZE1eGIK6vUNShRLdTDA mSWF0X/LzlyU8li/XIHHi3lvtODOGId4J9guHeLXtDYEyye5J4E3YAjc+8fSIcp94b1s G0f0mRRPLlY6B+nl++MOalfJQ9zQ7UUeXhbaHNqwwBmS2BIWNEcAzUc3IPoCuhQluiH0 L2kGQp1sBiN4UmqrRQjDuGgGmh2+ucIiQNTrRJvcjlU2akzkClqlY+DxfXoNsHXLbIlI BTNeyKS15GT92VUT9m2n7pr1+XBRNLc/imM1UM756i7v5KIH3twKw8luRxTGmByMLuhT itTw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=sI2FXOL4; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-76000-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76000-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p16-20020a170902e75000b001d945458de9si9623062plf.310.2024.02.21.23.11.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 23:11:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76000-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=sI2FXOL4; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-76000-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76000-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id AAEF0B229B7 for ; Thu, 22 Feb 2024 07:09:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C760F1BC44; Thu, 22 Feb 2024 07:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="sI2FXOL4" 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 5374817583; 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=NlXNkEVWOuJmH8FOiwQVkHwEoxM9/huggCaHG8tUcB/e9snrkrJX1q7Q6Sr/12LsaFxeSpBrksHwPQeuggw0GAEjSsEDKufgBi9sUSPZUEtVfirKhU0NVe5ArhIMPtqthKhR6hoGUZPIiaROkkUbGNTJ0Ap4etLUyukvv86NSwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708585706; c=relaxed/simple; bh=cR/IG5pmCHIdq4ymlgJjzjZH7hGnhfCNGmfTaQlgx2Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LrXFVmmcHsc9epTYneRAQM/4gXneZ6s38VyL1kDKL8C7/6KvuAjZ/i9FxSxM5pPYHSls9heZDB3ZeQcpah9w62h3rZjZ5S3Zn7V7NGuM8OH7P93fng2f5QKd244HLw+sE1+4lEGI1Y/EcjUMtKuyMv3viNc8/tRXgnXRe5F167Y= 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=sI2FXOL4; 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=cR/IG5pmCHIdq4ymlgJjzjZH7hGnhfCNGmfTaQlgx2Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sI2FXOL4hfum+t+KTRgchDnOI8GtyZ+U2OlwsKV+xRYJbFv7ZXz4VosAWZQpGkL6y pMr9HTuWloFx/WLC/nWwYV57tcifWRfUl/ZljHF3zTYfgGEAwZpkFU7ZAjkkUjIduK 8zzs7J1mQvHCBvcLnPQLVjyDSwOMvdh32FtJTiwk= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 22 Feb 2024 08:07:37 +0100 Subject: [PATCH 2/4] sysctl: move sysctl type to ctl_table_header Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240222-sysctl-empty-dir-v1-2-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?T?= =?utf-8?q?homas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708585698; l=3419; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=cR/IG5pmCHIdq4ymlgJjzjZH7hGnhfCNGmfTaQlgx2Q=; b=mXTAh1XCV3sH20hmYe/pluA998xG0eK+HatacPk2BM4CJfLqM772dOjRU172Oi9MS6/nsEYW9 LnrVAjlwabKDyoAi0cWgrqrclnCoeEKm2sif+4xpz3CYvNATXoBnFnl X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791582034249823273 X-GMAIL-MSGID: 1791582173917275964 As static initialization of the is not possible anymore move it into init_header() where all the other header fields are also initialized. Reduce memory consumption as there are less instances of ctl_table_header than ctl_table. Removing this mutable member also opens the way to constify static instances of ctl_table. Signed-off-by: Thomas Weißschuh --- fs/proc/proc_sysctl.c | 10 ++++++---- include/linux/sysctl.h | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 2f4d4329d83d..fde7a2f773f0 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -31,7 +31,7 @@ static const struct inode_operations proc_sys_dir_operations; /* Support for permanently empty directories */ static struct ctl_table sysctl_mount_point[] = { - {.type = SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY } + { } }; /** @@ -49,11 +49,11 @@ struct ctl_table_header *register_sysctl_mount_point(const char *path) EXPORT_SYMBOL(register_sysctl_mount_point); #define sysctl_is_perm_empty_ctl_header(hptr) \ - (hptr->ctl_table[0].type == SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY) + (hptr->type == SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY) #define sysctl_set_perm_empty_ctl_header(hptr) \ - (hptr->ctl_table[0].type = SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY) + (hptr->type = SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY) #define sysctl_clear_perm_empty_ctl_header(hptr) \ - (hptr->ctl_table[0].type = SYSCTL_TABLE_TYPE_DEFAULT) + (hptr->type = SYSCTL_TABLE_TYPE_DEFAULT) void proc_sys_poll_notify(struct ctl_table_poll *poll) { @@ -208,6 +208,8 @@ static void init_header(struct ctl_table_header *head, node++; } } + if (table == sysctl_mount_point) + sysctl_set_perm_empty_ctl_header(head); } static void erase_header(struct ctl_table_header *head) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index ee7d33b89e9e..c87f73c06cb9 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -137,17 +137,6 @@ struct ctl_table { void *data; int maxlen; umode_t mode; - /** - * enum type - Enumeration to differentiate between ctl target types - * @SYSCTL_TABLE_TYPE_DEFAULT: ctl target with no special considerations - * @SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY: Used to identify a permanently - * empty directory target to serve - * as mount point. - */ - enum { - SYSCTL_TABLE_TYPE_DEFAULT, - SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY - } type; proc_handler *proc_handler; /* Callback for text formatting */ struct ctl_table_poll *poll; void *extra1; @@ -188,6 +177,17 @@ struct ctl_table_header { struct ctl_dir *parent; struct ctl_node *node; struct hlist_head inodes; /* head for proc_inode->sysctl_inodes */ + /** + * enum type - Enumeration to differentiate between ctl target types + * @SYSCTL_TABLE_TYPE_DEFAULT: ctl target with no special considerations + * @SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY: Used to identify a permanently + * empty directory target to serve + * as mount point. + */ + enum { + SYSCTL_TABLE_TYPE_DEFAULT, + SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY, + } type; }; struct ctl_dir { From patchwork Thu Feb 22 07:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 204580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp78818dyb; Wed, 21 Feb 2024 23:09:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUJzRuLPyLEjwzSaogaXY7r206B1/LiOmywUndpJFY70NYlKViM5E4hp9Sr8IKTAdYDDVmGAfl3u42XhsEPV+hd9vfAVQ== X-Google-Smtp-Source: AGHT+IH3EXcNoZMfHQYhuqmjijIqw7CLxxC9zg3ENeNudu0J3E432wGJpCwsMoDxU0Y/wFWCl76f X-Received: by 2002:ae9:c202:0:b0:787:2cc2:41c1 with SMTP id j2-20020ae9c202000000b007872cc241c1mr2454044qkg.25.1708585769326; Wed, 21 Feb 2024 23:09:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708585769; cv=pass; d=google.com; s=arc-20160816; b=BVBRdz8HjkTasYya+oaq3YuVgfJhe7pdXscsYsvUovAuuMv0r5OLH0mu0M7mVI4xPp dDyq7nVgPh/opa1jW2UFiVHHJdQLbJiLJ+p517CAJSyPwWktelQnW+GQ5qx1zB7ygMjS eGMPGrZnw6GwW5Et8Z0ek+mtna1fj9OORjw87fsAgJsVp7YzxjUr0Aqe5iPoxHwt7EdC 7iPKcaoUofUBeceN26p3o5L0AKiI/D3Mkg/fo9sDEoF530CyX8p6kIoNROhkb/xiHUzw Uv0DIY1CPDwcIUgKEqcwd2tOmJwni7nMhVRtpVzZXOqooU90N6UFfUIp3RLMLtcpv4+9 0+bg== 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=DELvgqmLMNroFvNwOOw4aSnjkKoLQseUGqDHzB1fqqw=; fh=bv1xmQMLoUkjMaBG31+T8n2MW2r2VJMdwGgIEDt2AwQ=; b=txhUAiGR8WdRYb2car9/SwrZXv2mZemzJ7aTfSbwc2HiHoelvl6IHY0untC3CKBpbC RXZL8mA3oWhXGgK7qui51/HP3bYqkJihQoDvbPs2cnG+Xhy1fiPqe/tLAqJKqlpQRaP1 ZEGw9amniC9J3ENqsogd6Mi30OpL7VP7DD+Lr7B6zGPLxbSApWrbaznFSkIW03ArfMFa KYyPl88jR89n46x8vxjz0Aa3N1KjOHfaBI+hKwjViLxDYZSQBWwxfCiHtRr+5ctIvUoi 620wLgYUEWodCDcrHsbZDcMBW0YAmy5q+QqKg8OGUX0rS7efrTLtiE7VEsTtAiveT3fD D63w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=HcAI79BJ; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-76002-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76002-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b17-20020a05620a119100b007877aff36e8si4800476qkk.468.2024.02.21.23.09.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 23:09:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76002-ouuuleilei=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=HcAI79BJ; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-76002-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76002-ouuuleilei=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 1EA271C216B6 for ; Thu, 22 Feb 2024 07:09:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4B651B7F3; Thu, 22 Feb 2024 07:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="HcAI79BJ" 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 53775175A4; 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=K5s4PB4+r048+ywB1f8R+QHY5j7TUJImnTCn0uGpM6XwddUTAG7H6rPjZa7oYvQI2jaCD/6k2oyNCqJhPTdUPlK4QPrAwdKK+WCMzJIsp9yR/mUM1xz1X1gjePIfuUupKVFJdCMbsDpcVJtI/sb4kaaO9I/MYyYrQbBlR/vfkJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708585706; c=relaxed/simple; bh=JCJJxjzDXGYJItYXCEzMjq/GSfQbqYm3SGRGNchibxI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WC4/MsfvLXcCPbJJ8iRqbsmPWN2Su3YDCM5DKoT/cH844OB1wWNZWmVhsEgJPyQU5FqT4VIWiPxE3Ie3K7nUbzT+/TLUTLEcOJynTw/fhNWmtYVpoVG58ScpDIzcUDaUrVkMh4P9Ph6n8tQU+yLGerfiIp1JypMJGTjzXN5t1nI= 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=HcAI79BJ; 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=JCJJxjzDXGYJItYXCEzMjq/GSfQbqYm3SGRGNchibxI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HcAI79BJ0jlUL64zT1OuRh30+urTZW+qC87py30RIz7eGcHIx66WFDtT39zDGmBJm HM3AVr97CHd1Z8uGeyoAPguoaxClQUfFoLFvizAGCSHNeEYre8uZUt8gUbcb1VYQSC /WwVQMPXKIeLbMGJhKlB0+r/vFxcH0nAiNkLKK28= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 22 Feb 2024 08:07:38 +0100 Subject: [PATCH 3/4] sysctl: drop now unnecessary out-of-bounds check Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240222-sysctl-empty-dir-v1-3-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?T?= =?utf-8?q?homas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708585698; l=869; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=JCJJxjzDXGYJItYXCEzMjq/GSfQbqYm3SGRGNchibxI=; b=XWUZnHu/nkrMeHxEs4qbmkwfAlq1rR7FWvv8k9GTBVFOuFcu7uJK8PSl+A+MtiSLWEAvAhI0I j8M7KbOPm+UA6bCmIRyLxiSyxfCwt6TFMzbkTTAlz2f+gifo220SAsx X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791582031399961966 X-GMAIL-MSGID: 1791582031399961966 The type field is now part of the header so sysctl_is_perm_empty_ctl_header() can safely be executed even without any ctl_tables. Signed-off-by: Thomas Weißschuh --- fs/proc/proc_sysctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index fde7a2f773f0..4cdf98c6a9a4 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -232,8 +232,7 @@ static int insert_header(struct ctl_dir *dir, struct ctl_table_header *header) return -EROFS; /* Am I creating a permanently empty directory? */ - if (header->ctl_table_size > 0 && - sysctl_is_perm_empty_ctl_header(header)) { + if (sysctl_is_perm_empty_ctl_header(header)) { if (!RB_EMPTY_ROOT(&dir->root)) return -EINVAL; sysctl_set_perm_empty_ctl_header(dir_h); From patchwork Thu Feb 22 07:07:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 204579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp78802dyb; Wed, 21 Feb 2024 23:09:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXGmOo7sbjQ8+dW4CftvNEAfZGwoEc8DctEBQr/2tw7OBJMBKzyu+0BV6HlYXeoodw1rDzEytkGbfZzZSv5fElALxgdBA== X-Google-Smtp-Source: AGHT+IFPQ3G/OpTflbXWN3S8IIohV2IcwIsdOreBZ4ZaOKsq+AdPHDq34kZHtVzjTZ6dY9ip/E56 X-Received: by 2002:a17:902:f54a:b0:1db:fd89:791d with SMTP id h10-20020a170902f54a00b001dbfd89791dmr13108664plf.39.1708585768178; Wed, 21 Feb 2024 23:09:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708585768; cv=pass; d=google.com; s=arc-20160816; b=Tz+0PRWQroGNybCSbJvpw2FV/hLVj43Fr+xE0xulrCGdTP1mDvEStj4FABvNhM1OoL 9n/8dIHD9aayzu1zlVnLLCywFpiRhgwl57mITa0oIJ/EiR5wdOitHyF7vwrDVvLsNX1B z/Z7PjM3POX1C4HuNLADtAjrkyHkqtB3IchtfzthSr4U1kDPiLJJ2HNYJ3JxW70yjze9 Yb5eFZSOyOGlL5d7k6lx2rkYtVlLrs2F6FZQX6RPuqJmivBYHRaL+ze1Ks0Q4I6qMB2T 33+U64vA7BZhGLI2CaE84SHroUKdiOyPIzM7t+8B+9SW3y5nBxVhyQeHKmitTPEEKLl1 qscw== 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=X71Sy0EjKNS6NzXCYgApzwUmlel8VsTWbVPWdtfUJ9Y=; fh=bv1xmQMLoUkjMaBG31+T8n2MW2r2VJMdwGgIEDt2AwQ=; b=VFjU2mb3/vBgas0cqxOqfKI7ua9LuwfKo6Suke61NSnfX1XwRbLtEWn1GJ8ksSoxLY lCJ61R2buA9YOQ5XbUEKcHXUrQ0LHchDcxjV70hDMT8idY2F59zG25eAwM7AxZw/rEwk n21NFhdljtLe0IATY5jWyGBTexLbCF8Au9O8FdIlFNfk7yzjTVL5OluvdqbH0bAocQID aeWW3T8cV+LIUUxMqUMF86xprPGpe00XM2qxylUjHpXLhBZA6R7g91EQF6obJaXrqOPZ eOWBL9UTwKjv460GzbDuQESmdPy8RoYIyw0tIQR5pc773N5xHUs00PrEl1tjCFMqRD2M WUWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=kfpfrpSn; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-75999-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75999-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g1-20020a170902740100b001dc41a37400si1561295pll.343.2024.02.21.23.09.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 23:09:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75999-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=kfpfrpSn; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-75999-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75999-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DFF362845DF for ; Thu, 22 Feb 2024 07:09:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9415B1B7EB; Thu, 22 Feb 2024 07:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="kfpfrpSn" 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 536F4FBF4; 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=1708585705; cv=none; b=fmU1zrJOudW0bPtaMZadLdgkSLprR7tYKkge/XFmqPcput0cnbjEDYfogjI+u+04OC10zvEhU0uLQJ2kzwLEiK8KmkRjgH5Cp/R5id6zryxy2v6l793trWN/SRGCPn3hNlGHS8UgxkXeMTA73p/BULKfg9ViIKwhqaxBIvYeedw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708585705; c=relaxed/simple; bh=4zCBJsh7fJS40bmuhRJsZyTvqmWDnPyWNdh+rXA5TBE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PNN/hJkXbVU+9gzBgDnwsGZAaUVn+lWvqGhd9R4hhbjNX/Wk5m27/ATumhNgd0ki7tnzeZYB8WIXORPaqWMD/GYjHS+Ufx4uZwHxnl1lDuXKqE4y6maCZv+4wdM+QhSVfAW48uSBjDn7PY0SyECc/wAhm80XfP37aSboSWc9qJA= 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=kfpfrpSn; 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=4zCBJsh7fJS40bmuhRJsZyTvqmWDnPyWNdh+rXA5TBE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kfpfrpSn5Sosahn9w0/N4Hwunvz/qC0SqCcA70XH9LYfF11Y1Bvyz/e2FzgXTVI80 D89tkTexwvJib32t8Nl+fWegmBEnjtoxweReaKb2iXzisfkAraIAMuHBgU9eAfTww1 u7QLIfFaam4nk6FIYvVD656XrP7G0Uta9mIg2B0Y= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 22 Feb 2024 08:07:39 +0100 Subject: [PATCH 4/4] sysctl: remove unnecessary sentinel element Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240222-sysctl-empty-dir-v1-4-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?T?= =?utf-8?q?homas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708585698; l=791; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=4zCBJsh7fJS40bmuhRJsZyTvqmWDnPyWNdh+rXA5TBE=; b=WV3z1hGVhUXi4muzHz37oKOsSKmI58FcQqf5wS6HJGnQ+1+6bAHJbYjCw1dcDstuNx872V0W9 QP2m1pZzqyFBT/bAmcNoZ6/2Z3Nv6g6kx4zPCXWQul/wG9igeJlNI6V X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791582030648705189 X-GMAIL-MSGID: 1791582030648705189 The previous commits made this sentinel element unnecessary, remove it. Signed-off-by: Thomas Weißschuh --- fs/proc/proc_sysctl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 4cdf98c6a9a4..7c0e27dc3d9d 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -30,9 +30,7 @@ static const struct file_operations proc_sys_dir_file_operations; static const struct inode_operations proc_sys_dir_operations; /* Support for permanently empty directories */ -static struct ctl_table sysctl_mount_point[] = { - { } -}; +static struct ctl_table sysctl_mount_point[] = { }; /** * register_sysctl_mount_point() - registers a sysctl mount point