]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
seccomp: fix build warnings when there is no CONFIG_SECCOMP_FILTER
authorWill Drewry <wad@chromium.org>
Tue, 17 Apr 2012 19:48:58 +0000 (14:48 -0500)
committerJames Morris <james.l.morris@oracle.com>
Wed, 18 Apr 2012 02:24:52 +0000 (12:24 +1000)
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>
kernel/seccomp.c

index d9db6ec46bc9d9f3d1749dbd5c5d7f6d7dfd742a..ee376beedaf96ca31cc3066d06cedf59a552290f 100644 (file)
@@ -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;
 }