]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
apparmor: properly check lxc_strmmap ret value
authorAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Fri, 9 Dec 2022 17:31:04 +0000 (18:31 +0100)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 16 Dec 2022 16:36:41 +0000 (11:36 -0500)
Reported-by: coverity (CID #1517320)
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
src/lxc/lsm/apparmor.c

index bf0f771e287fd996432d4cf238a6d2f70267a63f..23af021aae7b21257e3677d69ee1efeea009e4ec 100644 (file)
@@ -975,7 +975,7 @@ static int load_apparmor_profile(struct lsm_ops *ops, struct lxc_conf *conf, con
                old_len = profile_sb.st_size;
                old_content = lxc_strmmap(NULL, old_len, PROT_READ,
                                          MAP_PRIVATE, profile_fd, 0);
-               if (!old_content) {
+               if (old_content == MAP_FAILED) {
                        SYSERROR("Failed to mmap old profile from %s",
                                 profile_path);
                        goto out;