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 <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410240553.gYNIXN8i-lkp@intel.com/
Fixes: 031acdcfb5 ("um: restore process name")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2024-10-24 09:52:51 +02:00
parent 3f17fed214
commit d61ac4a749

View File

@ -10,7 +10,6 @@
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <limits.h>
#include <sys/resource.h>
#include <sys/personality.h>
#include <as-layout.h>
@ -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));