diff options
author | Will Drewry <wad@chromium.org> | 2012-04-17 15:48:58 -0400 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2012-04-17 22:24:52 -0400 |
commit | 8156b451f37898d3c3652b4e988a4d62ae16eaac (patch) | |
tree | e310c816de65d28f5b5ecf75bc890ccc8a2c2514 | |
parent | e4da89d02f369450996cfd04f64b1cce4d8afaea (diff) |
seccomp: fix build warnings when there is no CONFIG_SECCOMP_FILTER
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>
Signed-off-by: James Morris <james.l.morris@oracle.com>
-rw-r--r-- | kernel/seccomp.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/kernel/seccomp.c b/kernel/seccomp.c index d9db6ec46bc9..ee376beedaf9 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c | |||
@@ -377,8 +377,7 @@ int __secure_computing(int this_syscall) | |||
377 | int mode = current->seccomp.mode; | 377 | int mode = current->seccomp.mode; |
378 | int exit_sig = 0; | 378 | int exit_sig = 0; |
379 | int *syscall; | 379 | int *syscall; |
380 | u32 ret = SECCOMP_RET_KILL; | 380 | u32 ret; |
381 | int data; | ||
382 | 381 | ||
383 | switch (mode) { | 382 | switch (mode) { |
384 | case SECCOMP_MODE_STRICT: | 383 | case SECCOMP_MODE_STRICT: |
@@ -392,12 +391,15 @@ int __secure_computing(int this_syscall) | |||
392 | return 0; | 391 | return 0; |
393 | } while (*++syscall); | 392 | } while (*++syscall); |
394 | exit_sig = SIGKILL; | 393 | exit_sig = SIGKILL; |
394 | ret = SECCOMP_RET_KILL; | ||
395 | break; | 395 | break; |
396 | #ifdef CONFIG_SECCOMP_FILTER | 396 | #ifdef CONFIG_SECCOMP_FILTER |
397 | case SECCOMP_MODE_FILTER: | 397 | case SECCOMP_MODE_FILTER: { |
398 | int data; | ||
398 | ret = seccomp_run_filters(this_syscall); | 399 | ret = seccomp_run_filters(this_syscall); |
399 | data = ret & SECCOMP_RET_DATA; | 400 | data = ret & SECCOMP_RET_DATA; |
400 | switch (ret & SECCOMP_RET_ACTION) { | 401 | ret &= SECCOMP_RET_ACTION; |
402 | switch (ret) { | ||
401 | case SECCOMP_RET_ERRNO: | 403 | case SECCOMP_RET_ERRNO: |
402 | /* Set the low-order 16-bits as a errno. */ | 404 | /* Set the low-order 16-bits as a errno. */ |
403 | syscall_set_return_value(current, task_pt_regs(current), | 405 | syscall_set_return_value(current, task_pt_regs(current), |
@@ -432,6 +434,7 @@ int __secure_computing(int this_syscall) | |||
432 | } | 434 | } |
433 | exit_sig = SIGSYS; | 435 | exit_sig = SIGSYS; |
434 | break; | 436 | break; |
437 | } | ||
435 | #endif | 438 | #endif |
436 | default: | 439 | default: |
437 | BUG(); | 440 | BUG(); |
@@ -442,8 +445,10 @@ int __secure_computing(int this_syscall) | |||
442 | #endif | 445 | #endif |
443 | audit_seccomp(this_syscall, exit_sig, ret); | 446 | audit_seccomp(this_syscall, exit_sig, ret); |
444 | do_exit(exit_sig); | 447 | do_exit(exit_sig); |
448 | #ifdef CONFIG_SECCOMP_FILTER | ||
445 | skip: | 449 | skip: |
446 | audit_seccomp(this_syscall, exit_sig, ret); | 450 | audit_seccomp(this_syscall, exit_sig, ret); |
451 | #endif | ||
447 | return -1; | 452 | return -1; |
448 | } | 453 | } |
449 | 454 | ||