* Re: [PATCH] fs/proc/base.c: Fix the wrong format specifier
@ 2025-09-03 9:13 Alexey Dobriyan
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Dobriyan @ 2025-09-03 9:13 UTC (permalink / raw)
To: zhangjiao2; +Cc: akpm, linux-kernel, linux-fsdevel
>- len = snprintf(name, sizeof(name), "%u", tid);
> + len = snprintf(name, sizeof(name), "%d", tid);
Ehh, no.
%u is correct because "tid" can't be negative.
%alexey
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] fs/proc/base.c: Fix the wrong format specifier
@ 2025-09-03 8:39 zhangjiao2
0 siblings, 0 replies; 2+ messages in thread
From: zhangjiao2 @ 2025-09-03 8:39 UTC (permalink / raw)
To: akpm
Cc: brauner, viro, lorenzo.stoakes, frederic, tglx, xu.xin16, mingo,
superman.xpt, linux-kernel, linux-fsdevel, zhang jiao
From: zhang jiao <zhangjiao2@cmss.chinamobile.com>
Use '%d' instead of '%u' for int.
Signed-off-by: zhang jiao <zhangjiao2@cmss.chinamobile.com>
---
fs/proc/base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index b997ceef9135..6299878e3d97 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3947,7 +3947,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx)
tid = task_pid_nr_ns(task, ns);
if (!tid)
continue; /* The task has just exited. */
- len = snprintf(name, sizeof(name), "%u", tid);
+ len = snprintf(name, sizeof(name), "%d", tid);
if (!proc_fill_cache(file, ctx, name, len,
proc_task_instantiate, task, NULL)) {
/* returning this tgid failed, save it as the first
--
2.33.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-03 9:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-03 9:13 [PATCH] fs/proc/base.c: Fix the wrong format specifier Alexey Dobriyan
-- strict thread matches above, loose matches on Subject: below --
2025-09-03 8:39 zhangjiao2
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®