From 3715d0c03fae815963cbcef66524a2deffda39e0 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 28 Oct 2020 04:01:19 +0100 Subject: [PATCH] utils: don't deref after NULL check Fixes: Coverity 1465855 Signed-off-by: Christian Brauner --- src/lxc/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/utils.c b/src/lxc/utils.c index c02eef152..561f7685c 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -1113,7 +1113,7 @@ int safe_mount_beneath(const char *beneath, const char *src, const char *dst, co __do_close int beneath_fd = -EBADF; const char *path = beneath ? beneath : "/"; - beneath_fd = openat(-1, beneath, O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_PATH); + beneath_fd = openat(-1, path, O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_PATH); if (beneath_fd < 0) return log_error_errno(-errno, errno, "Failed to open %s", path); -- 2.47.2