From ac22aaf5760ae670ae0a741c22173dfa22ef3baf Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 2 Jul 2024 23:30:31 -0700 Subject: [PATCH] apparmor: get_suspend_policy must return NULL in error cases Before this fix, it could return MAP_FAILED which is ((void *) -1). Signed-off-by: Andrei Vagin --- criu/apparmor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/criu/apparmor.c b/criu/apparmor.c index e46e239f5..48b639216 100644 --- a/criu/apparmor.c +++ b/criu/apparmor.c @@ -469,6 +469,7 @@ static void *get_suspend_policy(char *name, off_t *len) ret = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (ret == MAP_FAILED) { pr_perror("mmap of %s failed", file); + ret = NULL; goto out; }