From: Jan Kara Date: Tue, 2 Jun 2015 15:08:29 +0000 (+0200) Subject: audit: Fix check of return value of strnlen_user() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0b08c5e59441d08ab4b5e72afefd5cd98a4d83df;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git audit: Fix check of return value of strnlen_user() 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 Signed-off-by: Jan Kara Signed-off-by: Paul Moore --- diff --git a/kernel/auditsc.c b/kernel/auditsc.c index d81424fbec3a..f6bc31e7dca9 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -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;