[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240614130110.rovlk7be2ytkcm6x@joelS2.panther.com>
Date: Fri, 14 Jun 2024 15:01:10 +0200
From: Joel Granados <j.granados@...sung.com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Will Deacon <will@...nel.org>, Waiman Long <longman@...hat.com>, Boqun Feng
<boqun.feng@...il.com>, Suren Baghdasaryan <surenb@...gle.com>, "Kent
Overstreet" <kent.overstreet@...ux.dev>, Andrew Morton
<akpm@...ux-foundation.org>, Luis Chamberlain <mcgrof@...nel.org>, Kees Cook
<keescook@...omium.org>, "David S. Miller" <davem@...emloft.net>, "Eric
Dumazet" <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo
Abeni <pabeni@...hat.com>, <linux-kernel@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-fsdevel@...r.kernel.org>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH 8/8] sysctl: Warn on an empty procname element
On Tue, Jun 04, 2024 at 08:29:26AM +0200, Joel Granados via B4 Relay wrote:
> From: Joel Granados <j.granados@...sung.com>
>
> Add a pr_err warning in case a ctl_table is registered with a sentinel
> element containing a NULL procname.
>
> Signed-off-by: Joel Granados <j.granados@...sung.com>
> ---
> fs/proc/proc_sysctl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index 806700b70dea..f65098de5fcb 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -1119,6 +1119,8 @@ static int sysctl_check_table(const char *path, struct ctl_table_header *header)
> struct ctl_table *entry;
> int err = 0;
> list_for_each_table_entry(entry, header) {
> + if (!entry->procname)
> + err |= sysctl_err(path, entry, "procname is null");
> if ((entry->proc_handler == proc_dostring) ||
> (entry->proc_handler == proc_dobool) ||
> (entry->proc_handler == proc_dointvec) ||
>
> --
> 2.43.0
>
>
To add to this check, I sent out a static analysis check to smatch in
such a way that a warning will be printed out if there is a ctl_table
element with a procname or prog_handler that are NULL. You can see it
here https://lore.kernel.org/all/20240614-master-v1-1-c652f5aa15fb@samsung.com/
Best
--
Joel Granados
Powered by blists - more mailing lists