From d61ac4a7496a7981947b8b894d40b0e35c316fa5 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 24 Oct 2024 09:52:51 +0200 Subject: [PATCH] um: remove PATH_MAX use Evidently, PATH_MAX isn't always defined, at least not via . 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 Closes: https://lore.kernel.org/oe-kbuild-all/202410240553.gYNIXN8i-lkp@intel.com/ Fixes: 031acdcfb566 ("um: restore process name") Signed-off-by: Johannes Berg --- arch/um/os-Linux/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index 5e0cba5aee93..0afcdeb8995b 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -114,7 +113,7 @@ int __init main(int argc, char **argv, char **envp) ret = personality(PER_LINUX | ADDR_NO_RANDOMIZE); if (ret >= 0 && (ret & (PER_LINUX | ADDR_NO_RANDOMIZE)) != (PER_LINUX | ADDR_NO_RANDOMIZE)) { - char buf[PATH_MAX] = {}; + char buf[4096] = {}; ssize_t ret; ret = readlink("/proc/self/exe", buf, sizeof(buf));