From: Will Drewry <wad@chromium.org>
To: jmorris@namei.org
Cc: linux-kernel@vger.kernel.org, sfr@canb.auug.org.au,
linux-security-module@vger.kernel.org,
Will Drewry <wad@chromium.org>, Eric Paris <eparis@redhat.com>,
James Morris <james.l.morris@oracle.com>,
Kees Cook <keescook@chromium.org>,
Serge Hallyn <serge.hallyn@canonical.com>
Subject: [PATCH 2/2] seccomp: fix build warnings when there is no CONFIG_SECCOMP_FILTER
Date: Tue, 17 Apr 2012 14:48:58 -0500 [thread overview]
Message-ID: <1334692161-6834-2-git-send-email-wad@chromium.org> (raw)
In-Reply-To: <1334692161-6834-1-git-send-email-wad@chromium.org>
If both audit and seccomp filter support are disabled, 'ret' is marked
as unused.
If just seccomp filter support is disabled, data and skip are considered
unused.
This change fixes those build warnings.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Will Drewry <wad@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
---
kernel/seccomp.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index d9db6ec..ee376be 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -377,8 +377,7 @@ int __secure_computing(int this_syscall)
int mode = current->seccomp.mode;
int exit_sig = 0;
int *syscall;
- u32 ret = SECCOMP_RET_KILL;
- int data;
+ u32 ret;
switch (mode) {
case SECCOMP_MODE_STRICT:
@@ -392,12 +391,15 @@ int __secure_computing(int this_syscall)
return 0;
} while (*++syscall);
exit_sig = SIGKILL;
+ ret = SECCOMP_RET_KILL;
break;
#ifdef CONFIG_SECCOMP_FILTER
- case SECCOMP_MODE_FILTER:
+ case SECCOMP_MODE_FILTER: {
+ int data;
ret = seccomp_run_filters(this_syscall);
data = ret & SECCOMP_RET_DATA;
- switch (ret & SECCOMP_RET_ACTION) {
+ ret &= SECCOMP_RET_ACTION;
+ switch (ret) {
case SECCOMP_RET_ERRNO:
/* Set the low-order 16-bits as a errno. */
syscall_set_return_value(current, task_pt_regs(current),
@@ -432,6 +434,7 @@ int __secure_computing(int this_syscall)
}
exit_sig = SIGSYS;
break;
+ }
#endif
default:
BUG();
@@ -442,8 +445,10 @@ int __secure_computing(int this_syscall)
#endif
audit_seccomp(this_syscall, exit_sig, ret);
do_exit(exit_sig);
+#ifdef CONFIG_SECCOMP_FILTER
skip:
audit_seccomp(this_syscall, exit_sig, ret);
+#endif
return -1;
}
--
1.7.5.4
next parent reply other threads:[~2012-04-17 19:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1334692161-6834-1-git-send-email-wad@chromium.org>
2012-04-17 19:48 ` Will Drewry [this message]
2012-04-18 2:39 ` James Morris
2012-04-18 2:58 ` Will Drewry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334692161-6834-2-git-send-email-wad@chromium.org \
--to=wad@chromium.org \
--cc=eparis@redhat.com \
--cc=james.l.morris@oracle.com \
--cc=jmorris@namei.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge.hallyn@canonical.com \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®