From 2ab6484ff627aa6177b6471c486c5d1a24b7d8db Mon Sep 17 00:00:00 2001 From: Kailun Qin Date: Fri, 13 Aug 2021 06:24:24 -0400 Subject: [PATCH] libct/nsenter: no need to check size_t less than 0 According to C standards, `size_t` is always an unsigned integer type. Thus, checking unsigned expressions to be less than zero is not needed. Signed-off-by: Kailun Qin --- libcontainer/nsenter/nsexec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcontainer/nsenter/nsexec.c b/libcontainer/nsenter/nsexec.c index ee7b75b1e..8ab6f990d 100644 --- a/libcontainer/nsenter/nsexec.c +++ b/libcontainer/nsenter/nsexec.c @@ -311,7 +311,7 @@ static int try_mapping_tool(const char *app, int pid, char *map, size_t map_len) static void update_uidmap(const char *path, int pid, char *map, size_t map_len) { - if (map == NULL || map_len <= 0) + if (map == NULL || map_len == 0) return; write_log(DEBUG, "update /proc/%d/uid_map to '%s'", pid, map); @@ -326,7 +326,7 @@ static void update_uidmap(const char *path, int pid, char *map, size_t map_len) static void update_gidmap(const char *path, int pid, char *map, size_t map_len) { - if (map == NULL || map_len <= 0) + if (map == NULL || map_len == 0) return; write_log(DEBUG, "update /proc/%d/gid_map to '%s'", pid, map); @@ -341,7 +341,7 @@ static void update_gidmap(const char *path, int pid, char *map, size_t map_len) static void update_oom_score_adj(char *data, size_t len) { - if (data == NULL || len <= 0) + if (data == NULL || len == 0) return; write_log(DEBUG, "update /proc/self/oom_score_adj to '%s'", data);