sysctl: set variable sysctl_mount_point storage-class-specifier to static

Message ID 20230611120725.183182-1-trix@redhat.com
State New
Headers
Series sysctl: set variable sysctl_mount_point storage-class-specifier to static |

Commit Message

Tom Rix June 11, 2023, 12:07 p.m. UTC
  smatch reports
fs/proc/proc_sysctl.c:32:18: warning: symbol
  'sysctl_mount_point' was not declared. Should it be static?

This variable is only used in its defining file, so it should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 fs/proc/proc_sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Kees Cook June 13, 2023, 8:30 p.m. UTC | #1
On Sun, Jun 11, 2023 at 08:07:25AM -0400, Tom Rix wrote:
> smatch reports
> fs/proc/proc_sysctl.c:32:18: warning: symbol
>   'sysctl_mount_point' was not declared. Should it be static?
> 
> This variable is only used in its defining file, so it should be static.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Reviewed-by: Kees Cook <keescook@chromium.org>
  
Luis Chamberlain June 30, 2023, 11:20 p.m. UTC | #2
On Tue, Jun 13, 2023 at 01:30:47PM -0700, Kees Cook wrote:
> On Sun, Jun 11, 2023 at 08:07:25AM -0400, Tom Rix wrote:
> > smatch reports
> > fs/proc/proc_sysctl.c:32:18: warning: symbol
> >   'sysctl_mount_point' was not declared. Should it be static?
> > 
> > This variable is only used in its defining file, so it should be static.
> > 
> > Signed-off-by: Tom Rix <trix@redhat.com>
> 
> Reviewed-by: Kees Cook <keescook@chromium.org>

Queued up, thanks!

  Luis
  

Patch

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 2715e6114933..67872cbc0517 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -29,7 +29,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 */
-struct ctl_table sysctl_mount_point[] = {
+static struct ctl_table sysctl_mount_point[] = {
 	{.flags = SYSCTL_PERM_EMPTY_DIR }
 };