Skip to content

Commit d61ac4a

Browse files
committed
um: remove PATH_MAX use
Evidently, PATH_MAX isn't always defined, at least not via <limits.h>. Simply remove the use and replace it by a constant 4k. As stat::st_size is zero for /proc/self/exe we can't even size it automatically, and it seems unlikely someone's going to try to run UML with such a path. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: 031acdc ("um: restore process name") Signed-off-by: Johannes Berg <[email protected]>
1 parent 3f17fed commit d61ac4a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/um/os-Linux/main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <errno.h>
1111
#include <signal.h>
1212
#include <string.h>
13-
#include <limits.h>
1413
#include <sys/resource.h>
1514
#include <sys/personality.h>
1615
#include <as-layout.h>
@@ -114,7 +113,7 @@ int __init main(int argc, char **argv, char **envp)
114113
ret = personality(PER_LINUX | ADDR_NO_RANDOMIZE);
115114
if (ret >= 0 && (ret & (PER_LINUX | ADDR_NO_RANDOMIZE)) !=
116115
(PER_LINUX | ADDR_NO_RANDOMIZE)) {
117-
char buf[PATH_MAX] = {};
116+
char buf[4096] = {};
118117
ssize_t ret;
119118

120119
ret = readlink("/proc/self/exe", buf, sizeof(buf));

0 commit comments

Comments
 (0)