Skip to contentSkip to conversation

proc: use "unsigned int" in proc_fill_cache()

PATCH New Alexey Dobriyan 1 participant 1 message Apr 23, 2018 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: use "unsigned int" in proc_fill_cache()

All those lengths are unsigned as they should be.

---

 fs/proc/base.c     |    6 +++---
 fs/proc/fd.c       |    2 +-
 fs/proc/internal.h |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
fs/proc/base.c +3 -3
@@ -1874,7 +1874,7 @@ const struct dentry_operations pid_dentry_operations =
  * by stat.
  */
 bool proc_fill_cache(struct file *file, struct dir_context *ctx,
-	const char *name, int len,
+	const char *name, unsigned int len,
 	instantiate_t instantiate, struct task_struct *task, const void *ptr)
 {
 	struct dentry *child, *dir = file->f_path.dentry;
@@ -3263,7 +3263,7 @@ int proc_pid_readdir(struct file *file, struct dir_context *ctx)
 	     iter.task;
 	     iter.tgid += 1, iter = next_tgid(ns, iter)) {
 		char name[10 + 1];
-		int len;
+		unsigned int len;
 
 		cond_resched();
 		if (!has_pid_permissions(ns, iter.task, HIDEPID_INVISIBLE))
@@ -3595,7 +3595,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx)
 	     task;
 	     task = next_tid(task), ctx->pos++) {
 		char name[10 + 1];
-		int len;
+		unsigned int len;
 		tid = task_pid_nr_ns(task, ns);
 		len = snprintf(name, sizeof(name), "%u", tid);
 		if (!proc_fill_cache(file, ctx, name, len,
fs/proc/fd.c +1 -1
@@ -237,7 +237,7 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx,
 	     fd < files_fdtable(files)->max_fds;
 	     fd++, ctx->pos++) {
 		char name[10 + 1];
-		int len;
+		unsigned int len;
 
 		if (!fcheck_files(files, fd))
 			continue;
fs/proc/internal.h +1 -1
@@ -157,7 +157,7 @@ extern loff_t mem_lseek(struct file *, loff_t, int);
 /* Lookups */
 typedef int instantiate_t(struct inode *, struct dentry *,
 				     struct task_struct *, const void *);
-extern bool proc_fill_cache(struct file *, struct dir_context *, const char *, int,
+bool proc_fill_cache(struct file *, struct dir_context *, const char *, unsigned int,
 			   instantiate_t, struct task_struct *, const void *);
 
 /*