[CRIU] [PATCH] sk-unix: Use unsigned values for inodes

Cyrill Gorcunov gorcunov at gmail.com
Tue Mar 27 12:58:15 MSK 2018


From: Cyrill Gorcunov <gorcunov at virtuozzo.com>

It is especially important when accessing a hash --
there must be no negative indices ever.

https://jira.sw.ru/browse/PSBM-82945

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 criu/sk-unix.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 0b0fa699c826..a5bbe57653d0 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -101,7 +101,7 @@ struct unix_sk_listen_icon {
 
 static struct unix_sk_listen_icon *unix_listen_icons[SK_HASH_SIZE];
 
-static struct unix_sk_listen_icon *lookup_unix_listen_icons(int peer_ino)
+static struct unix_sk_listen_icon *lookup_unix_listen_icons(unsigned int peer_ino)
 {
 	struct unix_sk_listen_icon *ic;
 
@@ -702,8 +702,8 @@ static int unix_collect_one(const struct unix_diag_msg *m,
 	}
 
 	if (tb[UNIX_DIAG_ICONS]) {
-		int len = nla_len(tb[UNIX_DIAG_ICONS]);
-		int i;
+		unsigned int len = nla_len(tb[UNIX_DIAG_ICONS]);
+		unsigned int i;
 
 		d->icons = xmalloc(len);
 		if (!d->icons)
@@ -718,7 +718,7 @@ static int unix_collect_one(const struct unix_diag_msg *m,
 		 */
 		for (i = 0; i < d->nr_icons; i++) {
 			struct unix_sk_listen_icon *e, **chain;
-			int n;
+			unsigned int n;
 
 			e = xzalloc(sizeof(*e));
 			if (!e)
-- 
2.14.3



More information about the CRIU mailing list