audit: Fix check of return value of strnlen_user()
authorJan Kara <jack@suse.cz>
Tue, 2 Jun 2015 15:08:29 +0000 (17:08 +0200)
committerPaul Moore <pmoore@redhat.com>
Thu, 11 Jun 2015 19:49:54 +0000 (15:49 -0400)
strnlen_user() returns 0 when it hits fault, not -1. Fix the test in
audit_log_single_execve_arg(). Luckily this shouldn't ever happen unless
there's a kernel bug so it's mostly a cosmetic fix.

CC: Paul Moore <pmoore@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Paul Moore <pmoore@redhat.com>
kernel/auditsc.c

index d81424f..f6bc31e 100644 (file)
@@ -1021,7 +1021,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
         * for strings that are too long, we should not have created
         * any.
         */
-       if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) {
+       if (unlikely((len == 0) || len > MAX_ARG_STRLEN - 1)) {
                WARN_ON(1);
                send_sig(SIGKILL, current, 0);
                return -1;