Skip to contentSkip to conversation

fs: Eliminate compilation warnings for misc

PATCH In review Tianjia Zhang 3 participants 7 messages Nov 16, 2021 – Dec 1, 2021 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: Eliminate compilation warnings for misc

Eliminate the following clang compilation warnings by adding or fixing function comment:

fs/file.c:655: warning: Function parameter or member 'fdt' not described in 'last_fd' fs/file.c:655: warning: Excess function parameter 'cur_fds' description in 'last_fd' fs/file.c:703: warning: Function parameter or member 'flags' not described in '__close_range'

fs/fs_context.c:202: warning: Function parameter or member 'fc' not described in 'generic_parse_monolithic' fs/fs_context.c:202: warning: Excess function parameter 'ctx' description in 'generic_parse_monolithic' fs/fs_context.c:386: warning: Function parameter or member 'log' not described in 'logfc' fs/fs_context.c:386: warning: Function parameter or member 'prefix' not described in 'logfc' fs/fs_context.c:386: warning: Function parameter or member 'level' not described in 'logfc' fs/fs_context.c:386: warning: Excess function parameter 'fc' description in 'logfc'

fs/namei.c:1044: warning: Function parameter or member 'inode' not described in 'may_follow_link'

fs/read_write.c:88: warning: Function parameter or member 'maxsize' not described in 'generic_file_llseek_size' fs/read_write.c:88: warning: Excess function parameter 'size' description in 'generic_file_llseek_size'

---
 fs/file.c       | 3 ++-
 fs/fs_context.c | 6 ++++--
 fs/namei.c      | 1 +
 fs/read_write.c | 2 +-
 4 files changed, 8 insertions(+), 4 deletions(-)
fs/file.c +2 -1
index 8627dacfc424..ab3b635b0c86 100644
@@ -645,7 +645,7 @@ EXPORT_SYMBOL(close_fd); /* for ksys_close() */
 
 /**
  * last_fd - return last valid index into fd table
- * @cur_fds: files struct
+ * @fdt: fdtable struct
  *
  * Context: Either rcu read lock or files_lock must be held.
  *
@@ -695,6 +695,7 @@ static inline void __range_close(struct files_struct *cur_fds, unsigned int fd,
  *
  * @fd:     starting file descriptor to close
  * @max_fd: last file descriptor to close
+ * @flags:  close range flags
  *
  * This closes a range of file descriptors. All file descriptors
  * from @fd up to and including @max_fd are closed.
fs/fs_context.c +4 -2
index b7e43a780a62..e94fb7f19d3f 100644
@@ -189,7 +189,7 @@ EXPORT_SYMBOL(vfs_parse_fs_string);
 
 /**
  * generic_parse_monolithic - Parse key[=val][,key[=val]]* mount data
- * @ctx: The superblock configuration to fill in.
+ * @fc: filesystem context
  * @data: The data to parse
  *
  * Parse a blob of data that's in key[=val][,key[=val]]* form.  This can be
@@ -379,7 +379,9 @@ EXPORT_SYMBOL(vfs_dup_fs_context);
 
 /**
  * logfc - Log a message to a filesystem context
- * @fc: The filesystem context to log to.
+ * @log: The filesystem context to log to.
+ * @prefix: The log prefix.
+ * @level: The log level.
  * @fmt: The format of the buffer.
  */
 void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt, ...)
fs/namei.c +1 -0
index 1f9d2187c765..3bc73b4f39c9 100644
@@ -1028,6 +1028,7 @@ int sysctl_protected_regular __read_mostly;
 /**
  * may_follow_link - Check symlink following for unsafe situations
  * @nd: nameidata pathwalk data
+ * @inode: inode to check
  *
  * In the case of the sysctl_protected_symlinks sysctl being enabled,
  * CAP_DAC_OVERRIDE needs to be specifically ignored if the symlink is
fs/read_write.c +1 -1
index 0074afa7ecb3..d7b0f8528930 100644
@@ -71,7 +71,7 @@ EXPORT_SYMBOL(vfs_setpos);
  * @file:	file structure to seek on
  * @offset:	file offset to seek to
  * @whence:	type of seek
- * @size:	max size of this file in file system
+ * @maxsize:	max size of this file in file system
  * @eof:	offset used for SEEK_END position
  *
  * This is a variant of generic_file_llseek that allows passing in a custom
Signature · 1 line
2.32.0
#1 lore raw
Quoted 2 lines · Tianjia Zhang

Eliminate the following clang compilation warnings by adding or fixing function comment:

These warnings have nothing to do with clang. They're produced by scripts/kernel-doc:

                if (show_warnings($type, $declaration_name) && $param !~ /\./) {
                        print STDERR
                              "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n";
                        ++$warnings;
                }

They show up in any W=1 build (which tells you that people are not checking their patches with W=1)

fs/file.c EXPORT_SYMBOL(close_fd); /* for ksys_close() */ · line 648

Quoted 7 lines

+++ b/fs/file.c

fs/file.c +1 -1
@@ -645,7 +645,7 @@ EXPORT_SYMBOL(close_fd); /* for ksys_close() */
 
 /**
  * last_fd - return last valid index into fd table
- * @cur_fds: files struct
+ * @fdt: fdtable struct

I don't think the word 'struct' there really conveys any meaning.

#2 lore raw

Hi Matthew,

Quoted 7 lines · Matthew Wilcox
Quoted 2 lines · Tianjia Zhang

Eliminate the following clang compilation warnings by adding or fixing function comment:

These warnings have nothing to do with clang. They're produced by scripts/kernel-doc:

Quoted 9 lines
                 if (show_warnings($type, $declaration_name) && $param !~ /\./) {
                         print STDERR
                               "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n";
                         ++$warnings;
                 }

They show up in any W=1 build (which tells you that people are not checking their patches with W=1)

Yes, there will be this warning when compiling with W=1.

Quoted 10 lines

fs/file.c EXPORT_SYMBOL(close_fd); /* for ksys_close() */ · line 648

Quoted 7 lines

+++ b/fs/file.c

fs/file.c +1 -1
@@ -645,7 +645,7 @@ EXPORT_SYMBOL(close_fd); /* for ksys_close() */
 
  /**
   * last_fd - return last valid index into fd table
- * @cur_fds: files struct
+ * @fdt: fdtable struct

I don't think the word 'struct' there really conveys any meaning.

I think this is already a primitive, or is there any better suggestion?

Kind regards,
Tianjia

#3 lore raw
In reply to Tianjia Zhang
Quoted 2 lines · Tianjia Zhang

Eliminate the following clang compilation warnings by adding or fixing function comment:

These are from clang? They all appear to be from scripts/kernel-doc.

Can someone please clarify?

thanks.

Quoted 95 lines

fs/file.c:655: warning: Function parameter or member 'fdt' not described in 'last_fd' fs/file.c:655: warning: Excess function parameter 'cur_fds' description in 'last_fd' fs/file.c:703: warning: Function parameter or member 'flags' not described in '__close_range'

fs/fs_context.c:202: warning: Function parameter or member 'fc' not described in 'generic_parse_monolithic' fs/fs_context.c:202: warning: Excess function parameter 'ctx' description in 'generic_parse_monolithic' fs/fs_context.c:386: warning: Function parameter or member 'log' not described in 'logfc' fs/fs_context.c:386: warning: Function parameter or member 'prefix' not described in 'logfc' fs/fs_context.c:386: warning: Function parameter or member 'level' not described in 'logfc' fs/fs_context.c:386: warning: Excess function parameter 'fc' description in 'logfc'

fs/namei.c:1044: warning: Function parameter or member 'inode' not described in 'may_follow_link'

fs/read_write.c:88: warning: Function parameter or member 'maxsize' not described in 'generic_file_llseek_size' fs/read_write.c:88: warning: Excess function parameter 'size' description in 'generic_file_llseek_size'

---
  fs/file.c       | 3 ++-
  fs/fs_context.c | 6 ++++--
  fs/namei.c      | 1 +
  fs/read_write.c | 2 +-
  4 files changed, 8 insertions(+), 4 deletions(-)
fs/file.c +2 -1
index 8627dacfc424..ab3b635b0c86 100644
@@ -645,7 +645,7 @@ EXPORT_SYMBOL(close_fd); /* for ksys_close() */
 
  /**
   * last_fd - return last valid index into fd table
- * @cur_fds: files struct
+ * @fdt: fdtable struct
   *
   * Context: Either rcu read lock or files_lock must be held.
   *
@@ -695,6 +695,7 @@ static inline void __range_close(struct files_struct *cur_fds, unsigned int fd,
   *
   * @fd:     starting file descriptor to close
   * @max_fd: last file descriptor to close
+ * @flags:  close range flags
   *
   * This closes a range of file descriptors. All file descriptors
   * from @fd up to and including @max_fd are closed.
fs/fs_context.c +4 -2
index b7e43a780a62..e94fb7f19d3f 100644
@@ -189,7 +189,7 @@ EXPORT_SYMBOL(vfs_parse_fs_string);
 
  /**
   * generic_parse_monolithic - Parse key[=val][,key[=val]]* mount data
- * @ctx: The superblock configuration to fill in.
+ * @fc: filesystem context
   * @data: The data to parse
   *
   * Parse a blob of data that's in key[=val][,key[=val]]* form.  This can be
@@ -379,7 +379,9 @@ EXPORT_SYMBOL(vfs_dup_fs_context);
 
  /**
   * logfc - Log a message to a filesystem context
- * @fc: The filesystem context to log to.
+ * @log: The filesystem context to log to.
+ * @prefix: The log prefix.
+ * @level: The log level.
   * @fmt: The format of the buffer.
   */
  void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt, ...)
fs/namei.c +1 -0
index 1f9d2187c765..3bc73b4f39c9 100644
@@ -1028,6 +1028,7 @@ int sysctl_protected_regular __read_mostly;
  /**
   * may_follow_link - Check symlink following for unsafe situations
   * @nd: nameidata pathwalk data
+ * @inode: inode to check
   *
   * In the case of the sysctl_protected_symlinks sysctl being enabled,
   * CAP_DAC_OVERRIDE needs to be specifically ignored if the symlink is
fs/read_write.c +1 -1
index 0074afa7ecb3..d7b0f8528930 100644
@@ -71,7 +71,7 @@ EXPORT_SYMBOL(vfs_setpos);
   * @file:	file structure to seek on
   * @offset:	file offset to seek to
   * @whence:	type of seek
- * @size:	max size of this file in file system
+ * @maxsize:	max size of this file in file system
   * @eof:	offset used for SEEK_END position
   *
   * This is a variant of generic_file_llseek that allows passing in a custom
Signature · 1 line
~Randy
#4 lore raw

Hi Randy,

Quoted 9 lines · Randy Dunlap
Quoted 2 lines · Tianjia Zhang

Eliminate the following clang compilation warnings by adding or fixing function comment:

These are from clang?  They all appear to be from scripts/kernel-doc.

Can someone please clarify?

thanks.

Yes, compile with W=1, clang will report this warning.

Kind regards,
Tianjia

#5 lore raw
Quoted 7 lines · Tianjia Zhang

Hi Randy,

Quoted 4 lines · Randy Dunlap
Quoted 2 lines · Tianjia Zhang

Eliminate the following clang compilation warnings by adding or fixing function comment:

Quoted 7 lines
Quoted 5 lines

These are from clang?  They all appear to be from scripts/kernel-doc.

Can someone please clarify?

thanks.

Yes, compile with W=1, clang will report this warning.

No, clang has nothing to do with it. The warnings are from kernel-doc, not clang. Nor gcc.

#6 lore raw

Hi Matthew,

Quoted 10 lines · Matthew Wilcox
Quoted 9 lines · Tianjia Zhang

Hi Randy,

Quoted 6 lines · Randy Dunlap
Quoted 2 lines · Tianjia Zhang

Eliminate the following clang compilation warnings by adding or fixing function comment:

These are from clang?  They all appear to be from scripts/kernel-doc.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Can someone please clarify?

thanks.

Yes, compile with W=1, clang will report this warning.

No, clang has nothing to do with it. The warnings are from kernel-doc, not clang. Nor gcc.

I was negligent, you are right. Thanks for pointing it out.

Best regards,
Tianjia