From nobody Sat Sep 26 20:27:42 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 A890023504B for ; Sun, 30 Aug 2026 15:33:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788104027; cv=none; b=cftcKQEPJMsOlgH9H7Rzy4OJlzFhkdm+qzfv2kkSJ8vq71dPHup74ZUaTBSnf5lqkOwnJmuK6wui/fL2IwTlvt5dyfejNdf7c9/hD3ZV8V/MiiaE7qp+Db+8EWOJbDEVyTn/MCaaOZjtZZBMJvMfGE4ZLW5yf0/ccimMrRZzL5c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788104027; c=relaxed/simple; bh=jhm3NAZ+3y+d/lkEaiwYZfH+acAQltildDJNLfw55p0=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=fG4wgCd2gw9W2DJwcIXvCCctzOeifogjitgq2HLUic3HGziKUyt++oV45TvE4Wp0pOlJbtKd0Z9Gwg9Go7V0aAZl1lWxz8f8R56UBuDTOfO5or6WCt2HDIiqX6aaJSY/A9Yh5y/LcOb6Hj8sr28qg6A14n849iEjSfrpmh9DSXI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iOc1NuEL; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iOc1NuEL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788104024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=HQJuDZfOh9ePnHnEm41F5AAnflLozpPvVIN5x96NxUw=; b=iOc1NuELfEjLOZjeEwKAWhM0PgFJswBgBSQiiNQNlD8YcsMw4iYTupiYiwNuRGg46TOygR XSbALDSOKyseX0ZjPzyh6D1Kn085osYm/BA4ZXLOs4sn1MbZ23N6cZ23fBJYzdesHAWcCe F68oxHtLUxvTk4d8EySxjm9FDPk6p2A= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-504-EHG6YJaLNc2P2XxjBobwCA-1; Sun, 30 Aug 2026 11:33:40 -0400 X-MC-Unique: EHG6YJaLNc2P2XxjBobwCA-1 X-Mimecast-MFC-AGG-ID: EHG6YJaLNc2P2XxjBobwCA_1788104018 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 48A2119540F2; Sun, 30 Aug 2026 15:33:38 +0000 (UTC) Received: from fedora (unknown [10.44.48.13]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id AB5CA1800257; Sun, 30 Aug 2026 15:33:34 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sun, 30 Aug 2026 17:33:37 +0200 (CEST) Date: Sun, 30 Aug 2026 17:33:33 +0200 From: Oleg Nesterov To: Joel Granados Cc: Mark Brown , Luis Chamberlain , Sudip Mukherjee , Alexander Viro , Christian Brauner , Jan Kara , Kees Cook , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] sysctl: collapse redundant CONFIG_SYSCTL nesting in kernel/sysctl.c Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" After the removal of CONFIG_PROC_SYSCTL, several #ifdef CONFIG_SYSCTL blocks ended up nested inside the outer (now the same) CONFIG_SYSCTL guards. Collapse them and remove a now-stale "/proc/sys support" comment which referred to CONFIG_PROC_SYSCTL. Signed-off-by: Oleg Nesterov --- kernel/sysctl.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index f7b75985d542..d0a612c65b08 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -29,14 +29,12 @@ EXPORT_SYMBOL(sysctl_vals); const unsigned long sysctl_long_vals[] =3D { 0, 1, LONG_MAX }; EXPORT_SYMBOL_GPL(sysctl_long_vals); =20 -#if defined(CONFIG_SYSCTL) +#ifdef CONFIG_SYSCTL =20 /* Constants used for minimum and maximum */ static const int ngroups_max =3D NGROUPS_MAX; static const int cap_last_cap =3D CAP_LAST_CAP; =20 -#ifdef CONFIG_SYSCTL - /** * enum sysctl_writes_mode - supported sysctl write modes * @@ -64,14 +62,6 @@ enum sysctl_writes_mode { }; =20 static enum sysctl_writes_mode sysctl_writes_strict =3D SYSCTL_WRITES_STRI= CT; -#endif /* CONFIG_SYSCTL */ -#endif /* CONFIG_SYSCTL */ - -/* - * /proc/sys support - */ - -#ifdef CONFIG_SYSCTL =20 static int _proc_do_string(char *data, int maxlen, int dir, char *buffer, size_t *lenp, loff_t *ppos) @@ -1366,7 +1356,7 @@ int proc_do_large_bitmap(const struct ctl_table *tabl= e, int dir, =20 #endif /* CONFIG_SYSCTL */ =20 -#if defined(CONFIG_SYSCTL) +#ifdef CONFIG_SYSCTL int proc_do_static_key(const struct ctl_table *table, int dir, void *buffer, size_t *lenp, loff_t *ppos) { @@ -1398,7 +1388,6 @@ int proc_do_static_key(const struct ctl_table *table,= int dir, } =20 static const struct ctl_table sysctl_subsys_table[] =3D { -#ifdef CONFIG_SYSCTL { .procname =3D "sysctl_writes_strict", .data =3D &sysctl_writes_strict, @@ -1408,7 +1397,6 @@ static const struct ctl_table sysctl_subsys_table[] = =3D { .extra1 =3D SYSCTL_NEG_ONE, .extra2 =3D SYSCTL_ONE, }, -#endif { .procname =3D "ngroups_max", .data =3D (void *)&ngroups_max, --=20 2.52.0 From nobody Sat Sep 26 20:27:42 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 0080F23504B for ; Sun, 30 Aug 2026 15:33:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788104031; cv=none; b=haGgpsdhbf2ntr6z59bFDo1JZYuAxFryqdZWKKv624ygPRoie+sg0JB0wd2qnrgScVdYxqdqB/naA4AhjlYfGcA779XB2dc6Jn41xa6ACrmNGEH3J7Yt0pjOm/Wv5wwpK+ZckR0/CxCCv26YpWQhe4fCsuv8r7LjFPxH3avQia0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788104031; c=relaxed/simple; bh=y2mXXI4NcEMco3KVycXGDCt/sU6W/3q3C2TEB1HP+6k=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=G1+hyR4azwTUaTGUgsNhTVLYeBQe/bbxhTu86Pk5dRwEI/65pqEBip437aRGjoxaCqg8b5rj6NH9Lhx+0V2K5LUuY84T/IFE8mhyosgoZgYMZxwHcxIAaWvFdTNMgP3msJZIWj0x024AxSeuzbedKPSVIIK5AbPsWuO/uCeKLmM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XRxTXga2; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XRxTXga2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788104028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=oP+jvei6Pwgf08cgQpfmZlK7Y3SXlFtjw1xsW1B4eF0=; b=XRxTXga2RVPiSMNcR7/7NSNxzvYIDBDW4fAG1YvFGinmgFHN0C/aqOi9VoewSjHptkTYfX VaoAJ8tMqQKFZPRaRW3ZygzdQQl9/aXKPnrcaQSRNA34K727jB0QMbhfW4VPQ7PQ1nQ98i ngyvDnF5h3BjSDfBdqGRLZbiFwQYv3w= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-711-1_QL-Kg1M-izdDHe0NwhBA-1; Sun, 30 Aug 2026 11:33:45 -0400 X-MC-Unique: 1_QL-Kg1M-izdDHe0NwhBA-1 X-Mimecast-MFC-AGG-ID: 1_QL-Kg1M-izdDHe0NwhBA_1788104023 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6758B19540F2; Sun, 30 Aug 2026 15:33:43 +0000 (UTC) Received: from fedora (unknown [10.44.48.13]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 1E2DC7D6; Sun, 30 Aug 2026 15:33:39 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sun, 30 Aug 2026 17:33:42 +0200 (CEST) Date: Sun, 30 Aug 2026 17:33:38 +0200 From: Oleg Nesterov To: Joel Granados Cc: Mark Brown , Luis Chamberlain , Sudip Mukherjee , Alexander Viro , Christian Brauner , Jan Kara , Kees Cook , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] sysctl: consolidate CONFIG_SYSCTL into a single block in kernel/sysctl.c Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" After the previous cleanup there are two CONFIG_SYSCTL blocks. Move the second block up into the first one and eliminate the redundant Also add a proc_do_static_key() stub to the #else block. Not strictly necessary today, but consistent with the other stubs declared in include/linux/sysctl.h. Signed-off-by: Oleg Nesterov --- kernel/sysctl.c | 160 +++++++++++++++++++++++++----------------------- 1 file changed, 82 insertions(+), 78 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index d0a612c65b08..f6ea3eeeef65 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1255,6 +1255,87 @@ int proc_do_large_bitmap(const struct ctl_table *tab= le, int dir, return err; } =20 +int proc_do_static_key(const struct ctl_table *table, int dir, + void *buffer, size_t *lenp, loff_t *ppos) +{ + struct static_key *key =3D (struct static_key *)table->data; + static DEFINE_MUTEX(static_key_mutex); + int val, ret; + struct ctl_table tmp =3D { + .data =3D &val, + .maxlen =3D sizeof(val), + .mode =3D table->mode, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE, + }; + + if (SYSCTL_USER_TO_KERN(dir) && !capable(CAP_SYS_ADMIN)) + return -EPERM; + + mutex_lock(&static_key_mutex); + val =3D static_key_enabled(key); + ret =3D proc_dointvec_minmax(&tmp, dir, buffer, lenp, ppos); + if (SYSCTL_USER_TO_KERN(dir) && !ret) { + if (val) + static_key_enable(key); + else + static_key_disable(key); + } + mutex_unlock(&static_key_mutex); + return ret; +} + +static const struct ctl_table sysctl_subsys_table[] =3D { + { + .procname =3D "sysctl_writes_strict", + .data =3D &sysctl_writes_strict, + .maxlen =3D sizeof(int), + .mode =3D 0644, + .proc_handler =3D proc_dointvec_minmax, + .extra1 =3D SYSCTL_NEG_ONE, + .extra2 =3D SYSCTL_ONE, + }, + { + .procname =3D "ngroups_max", + .data =3D (void *)&ngroups_max, + .maxlen =3D sizeof (int), + .mode =3D 0444, + .proc_handler =3D proc_dointvec, + }, + { + .procname =3D "cap_last_cap", + .data =3D (void *)&cap_last_cap, + .maxlen =3D sizeof(int), + .mode =3D 0444, + .proc_handler =3D proc_dointvec, + }, +#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW + { + .procname =3D "unaligned-trap", + .data =3D &unaligned_enabled, + .maxlen =3D sizeof(int), + .mode =3D 0644, + .proc_handler =3D proc_dointvec, + }, +#endif +#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN + { + .procname =3D "ignore-unaligned-usertrap", + .data =3D &no_unaligned_warning, + .maxlen =3D sizeof (int), + .mode =3D 0644, + .proc_handler =3D proc_dointvec, + }, +#endif +}; + +int __init sysctl_init_bases(void) +{ + register_sysctl_init("kernel", sysctl_subsys_table); + + return 0; +} + #else /* CONFIG_SYSCTL */ =20 int proc_dostring(const struct ctl_table *table, int dir, @@ -1354,89 +1435,12 @@ int proc_do_large_bitmap(const struct ctl_table *ta= ble, int dir, return -ENOSYS; } =20 -#endif /* CONFIG_SYSCTL */ - -#ifdef CONFIG_SYSCTL int proc_do_static_key(const struct ctl_table *table, int dir, void *buffer, size_t *lenp, loff_t *ppos) { - struct static_key *key =3D (struct static_key *)table->data; - static DEFINE_MUTEX(static_key_mutex); - int val, ret; - struct ctl_table tmp =3D { - .data =3D &val, - .maxlen =3D sizeof(val), - .mode =3D table->mode, - .extra1 =3D SYSCTL_ZERO, - .extra2 =3D SYSCTL_ONE, - }; - - if (SYSCTL_USER_TO_KERN(dir) && !capable(CAP_SYS_ADMIN)) - return -EPERM; - - mutex_lock(&static_key_mutex); - val =3D static_key_enabled(key); - ret =3D proc_dointvec_minmax(&tmp, dir, buffer, lenp, ppos); - if (SYSCTL_USER_TO_KERN(dir) && !ret) { - if (val) - static_key_enable(key); - else - static_key_disable(key); - } - mutex_unlock(&static_key_mutex); - return ret; + return -ENOSYS; } =20 -static const struct ctl_table sysctl_subsys_table[] =3D { - { - .procname =3D "sysctl_writes_strict", - .data =3D &sysctl_writes_strict, - .maxlen =3D sizeof(int), - .mode =3D 0644, - .proc_handler =3D proc_dointvec_minmax, - .extra1 =3D SYSCTL_NEG_ONE, - .extra2 =3D SYSCTL_ONE, - }, - { - .procname =3D "ngroups_max", - .data =3D (void *)&ngroups_max, - .maxlen =3D sizeof (int), - .mode =3D 0444, - .proc_handler =3D proc_dointvec, - }, - { - .procname =3D "cap_last_cap", - .data =3D (void *)&cap_last_cap, - .maxlen =3D sizeof(int), - .mode =3D 0444, - .proc_handler =3D proc_dointvec, - }, -#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW - { - .procname =3D "unaligned-trap", - .data =3D &unaligned_enabled, - .maxlen =3D sizeof(int), - .mode =3D 0644, - .proc_handler =3D proc_dointvec, - }, -#endif -#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN - { - .procname =3D "ignore-unaligned-usertrap", - .data =3D &no_unaligned_warning, - .maxlen =3D sizeof (int), - .mode =3D 0644, - .proc_handler =3D proc_dointvec, - }, -#endif -}; - -int __init sysctl_init_bases(void) -{ - register_sysctl_init("kernel", sysctl_subsys_table); - - return 0; -} #endif /* CONFIG_SYSCTL */ /* * No sense putting this after each symbol definition, twice, --=20 2.52.0 From nobody Sat Sep 26 20:27:42 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 5CE7823504B for ; Sun, 30 Aug 2026 15:33:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788104036; cv=none; b=a7wAPVtgM+hHHHmJKnaxDJrWqW9rWuCR94ysPE1T8ZIJlqb1KJTbYBoHPfgtqtLsEqIzXt5Dq+GE58WNUfDkgXvnNLE1RC372/oe+TSZzGPX/nkiyw54m4SIv17UyZxhMUxLWLjfsLGptGFNzOKV3ZJkMHQy7WIx9Q0/90v1L0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788104036; c=relaxed/simple; bh=70oCqBBoSTv5DaCW/nFvu3CrymPxNOg5ubjmttCD2fc=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=sx6Q32nKRmWP+rEMjeTM2BXa4nBFraSZSo+tCBodivDVPjvBMhdmIizQf8L9t3fTFdqZ3rKRI/KMJCJW2x1IA2Nbn1tC+3YcA/wfiC6d6Y+52TD/TXt8w/xj8Wvj753emaemKMLNKIAp06EqXbqiyKDrLnAfjhgjtOU+eHaaRQs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gPGcMlAz; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gPGcMlAz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788104034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=GwKgkU/7anYEDkREv3CsBQbrNrroVx1a5tcXYAfd8fk=; b=gPGcMlAzi7YhVjCLfcft2xC8ygJGBn4UQHf1+PmDfLtli9LcujerPYfVxRi87ir96c9K0E eDWkJhAtf+AmNSxbMBM5LioePEQy1QeJ9CVvzsCOhG4++2xEmtKKNULXLs/XnGaE343Tv5 0JHfpOzg1QzUWrwp93X5L+EQXqOyjnM= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-141-L9TqTexIPRa0beGBqiHdiw-1; Sun, 30 Aug 2026 11:33:50 -0400 X-MC-Unique: L9TqTexIPRa0beGBqiHdiw-1 X-Mimecast-MFC-AGG-ID: L9TqTexIPRa0beGBqiHdiw_1788104029 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D08161800EC7; Sun, 30 Aug 2026 15:33:48 +0000 (UTC) Received: from fedora (unknown [10.44.48.13]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 86826195608A; Sun, 30 Aug 2026 15:33:45 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sun, 30 Aug 2026 17:33:48 +0200 (CEST) Date: Sun, 30 Aug 2026 17:33:43 +0200 From: Oleg Nesterov To: Joel Granados Cc: Mark Brown , Luis Chamberlain , Sudip Mukherjee , Alexander Viro , Christian Brauner , Jan Kara , Kees Cook , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] sysctl: remove redundant CONFIG_PROC_FS checks Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that CONFIG_PROC_SYSCTL is gone, CONFIG_SYSCTL depends on CONFIG_PROC_FS directly in fs/proc/Kconfig, so the double guard defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS) is redundant. Simplify to "#ifdef CONFIG_SYSCTL". Signed-off-by: Oleg Nesterov --- drivers/parport/procfs.c | 6 +++--- fs/dcache.c | 2 +- fs/file_table.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c index 3880460e67f2..1bfafc2a5724 100644 --- a/drivers/parport/procfs.c +++ b/drivers/parport/procfs.c @@ -26,7 +26,7 @@ =20 #include =20 -#if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS) +#ifdef CONFIG_SYSCTL =20 #define PARPORT_MIN_TIMESLICE_VALUE 1ul=20 #define PARPORT_MAX_TIMESLICE_VALUE ((unsigned long) HZ) @@ -560,7 +560,7 @@ static void __exit parport_default_proc_unregister(void) parport_bus_exit(); } =20 -#else /* no sysctl or no procfs*/ +#else /* CONFIG_SYSCTL */ =20 int parport_proc_register(struct parport *pp) { @@ -591,7 +591,7 @@ static void __exit parport_default_proc_unregister (voi= d) { parport_bus_exit(); } -#endif +#endif /* CONFIG_SYSCTL */ =20 subsys_initcall(parport_default_proc_register) module_exit(parport_default_proc_unregister) diff --git a/fs/dcache.c b/fs/dcache.c index 1b1a81f10da6..7ce421e9191f 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -144,7 +144,7 @@ static DEFINE_PER_CPU(long, nr_dentry_unused); static DEFINE_PER_CPU(long, nr_dentry_negative); static int dentry_negative_policy; =20 -#if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS) +#ifdef CONFIG_SYSCTL /* Statistics gathering. */ static struct dentry_stat_t dentry_stat =3D { .age_limit =3D 45, diff --git a/fs/file_table.c b/fs/file_table.c index c68b8c0a4097..08ca3631b726 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -122,7 +122,7 @@ unsigned long get_max_files(void) } EXPORT_SYMBOL_GPL(get_max_files); =20 -#if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS) +#ifdef CONFIG_SYSCTL =20 /* * Handle nr_files sysctl --=20 2.52.0