livepatch: Use static buffer for debugging messages under rq lock
authorPetr Mladek <pmladek@suse.com>
Fri, 31 May 2019 07:41:47 +0000 (09:41 +0200)
committerPetr Mladek <pmladek@suse.com>
Wed, 5 Jun 2019 14:35:47 +0000 (16:35 +0200)
The err_buf array uses 128 bytes of stack space.  Move it off the stack
by making it static.  It's safe to use a shared buffer because
klp_try_switch_task() is called under klp_mutex.

Acked-by: Miroslav Benes <mbenes@suse.cz>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
kernel/livepatch/transition.c

index c53370d596be6b5c271eeb7f3ccdefde94450139..0a3889c4f617fea572b6485f6f4d10183715b90d 100644 (file)
@@ -293,11 +293,11 @@ static int klp_check_stack(struct task_struct *task, char *err_buf)
  */
 static bool klp_try_switch_task(struct task_struct *task)
 {
+       static char err_buf[STACK_ERR_BUF_SIZE];
        struct rq *rq;
        struct rq_flags flags;
        int ret;
        bool success = false;
-       char err_buf[STACK_ERR_BUF_SIZE];
 
        err_buf[0] = '\0';
 
@@ -340,7 +340,6 @@ done:
                pr_debug("%s", err_buf);
 
        return success;
-
 }
 
 /*