Commit 673d1c77 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

seccomp: Fix nits in collect_filter

- Fix typo in sizeof() operand
 - Eliminate redundant prctl calls if no PTRACE_SECCOMP_GET_METADATA
   detected
Reported-by: 's avatarDmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent b4451351
......@@ -151,21 +151,20 @@ static int collect_filter(struct seccomp_entry *entry)
}
}
if (!meta)
meta = &meta_buf;
meta->flags = 0;
if (meta) {
meta->filter_off = i;
if (ptrace(PTRACE_SECCOMP_GET_METADATA, entry->tid_real, sizeof(meta), meta) < 0) {
if (ptrace(PTRACE_SECCOMP_GET_METADATA, entry->tid_real, sizeof(*meta), meta) < 0) {
if (errno == EIO) {
/* Old kernel, no METADATA support */
meta = NULL;
} else {
pr_perror("Can't fetch seccomp metadataon tid_real %d pos %zu",
pr_perror("Can't fetch seccomp metadata on tid_real %d pos %zu",
entry->tid_real, i);
return -1;
}
}
}
chain = xzalloc(sizeof(*chain));
if (!chain)
......
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