[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200420205743.19964-10-adobriyan@gmail.com>
Date: Mon, 20 Apr 2020 23:57:38 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: akpm@...ux-foundation.org
Cc: adobriyan@...il.com, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, pmladek@...e.com,
rostedt@...dmis.org, sergey.senozhatsky@...il.com,
andriy.shevchenko@...ux.intel.com, linux@...musvillemoes.dk
Subject: [PATCH 10/15] print_integer, proc: rewrite /proc/*/fd via print_integer()
Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---
fs/proc/fd.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index e098302b5101..059a3404c785 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -247,8 +247,8 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx,
fd++, ctx->pos++) {
struct file *f;
struct fd_data data;
- char name[10 + 1];
- unsigned int len;
+ char buf[10];
+ char *p = buf + sizeof(buf);
f = fcheck_files(files, fd);
if (!f)
@@ -257,9 +257,9 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx,
rcu_read_unlock();
data.fd = fd;
- len = snprintf(name, sizeof(name), "%u", fd);
+ p = _print_integer_u32(p, fd);
if (!proc_fill_cache(file, ctx,
- name, len, instantiate, tsk,
+ p, buf + sizeof(buf) - p, instantiate, tsk,
&data))
goto out_fd_loop;
cond_resched();
--
2.24.1
Powered by blists - more mailing lists