Thread (14 messages) 14 messages, 3 authors, 2011-07-23

Re: [uml-devel] [PATCH 09/10] um: Ajdust size of pid_buf

From: Richard Weinberger <richard@nod.at>
Date: 2011-07-21 09:48:34
Also in: lkml

Am Donnerstag 21 Juli 2011, 11:38:11 schrieb Geert Uytterhoeven:
On Thu, Jul 21, 2011 at 11:18, Richard Weinberger [off-list ref] wrote:
quoted
Linux can have pids up to 4*1024*1024.
To handle such huge numbers pid_buf needs to be larger.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
---
 arch/um/drivers/harddog_user.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/um/drivers/harddog_user.c
b/arch/um/drivers/harddog_user.c index b56f8e0..84dce3f 100644
--- a/arch/um/drivers/harddog_user.c
+++ b/arch/um/drivers/harddog_user.c
@@ -32,7 +32,7 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret,
char *sock) {
       struct dog_data data;
       int in_fds[2], out_fds[2], pid, n, err;
-       char pid_buf[sizeof("nnnnn\0")], c;
+       char pid_buf[sizeof("nnnnnnn\0")], c;
Why not make it handle the full 32-bit? That's just a few bytes extra
on the stack...
True.
The sizeof("nnnnnnn\0") crap will anyway go away.
ASAP I'll submit a patch which removes all sizeof("nnnnnnn\0") and replaces
sprintf() with snprintf().

Thanks,
//richard
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help