From: Emil Velikov Date: Wed, 7 May 2025 10:58:56 +0000 (+0100) Subject: shared: remove unreachable snprintf error case X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9615035e7b8b05b6033883f87a4fd6912040ccd7;p=thirdparty%2Fkmod.git shared: remove unreachable snprintf error case It is practically impossible for `/proc/self/fd/%d` to result in a string of PATH_MAX size. Remove the unreachable error handling. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/345 Signed-off-by: Lucas De Marchi --- diff --git a/shared/util.c b/shared/util.c index b10122ce..2c6cfa96 100644 --- a/shared/util.c +++ b/shared/util.c @@ -482,9 +482,7 @@ char *fd_lookup_path(int fd) char fd_path[PATH_MAX]; ssize_t len; - len = snprintf(proc_path, sizeof(proc_path), "/proc/self/fd/%d", fd); - if (len < 0 || len >= (ssize_t)sizeof(proc_path)) - return NULL; + snprintf(proc_path, sizeof(proc_path), "/proc/self/fd/%d", fd); /* * We are using mkstemp to create a temporary file. We need to read the link since