2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

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 <avagin@gmail.com>
This commit is contained in:
Andrei Vagin 2024-07-02 23:30:31 -07:00
parent 71999d8883
commit ac22aaf576

View File

@ -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;
}