Commit 80d2c215 authored by Andrei Vagin's avatar Andrei Vagin Committed by Andrei Vagin

mount: don't dereference pointer before null check

CID 190775 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking m->parent suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 8c817b2b
...@@ -833,13 +833,14 @@ static int resolve_external_mounts(struct mount_info *info) ...@@ -833,13 +833,14 @@ static int resolve_external_mounts(struct mount_info *info)
static int root_path_from_parent(struct mount_info *m, char *buf, int size) static int root_path_from_parent(struct mount_info *m, char *buf, int size)
{ {
bool head_slash = false, tail_slash = false; bool head_slash = false, tail_slash = false;
int p_len = strlen(m->parent->mountpoint), int p_len, m_len, len;
m_len = strlen(m->mountpoint),
len;
if (!m->parent) if (!m->parent)
return -1; return -1;
p_len = strlen(m->parent->mountpoint),
m_len = strlen(m->mountpoint),
len = snprintf(buf, size, "%s", m->parent->root); len = snprintf(buf, size, "%s", m->parent->root);
if (len >= size) if (len >= size)
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment