[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180621065802.GA495@jagdpanzerIV>
Date: Thu, 21 Jun 2018 15:58:02 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: Namit Gupta <gupta.namit@...sung.com>
Cc: pmladek@...e.com, sergey.senozhatsky@...il.com,
rostedt@...dmis.org, linux-kernel@...r.kernel.org,
pankaj.m@...sung.com, a.sahrawat@...sung.com,
himanshu.m@...sung.com
Subject: Re: [PATCH] printk: remove unnecessary kmalloc() from syslog during
clear
On (06/20/18 19:26), Namit Gupta wrote:
[..]
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 512f7c2..53952ce 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -1348,71 +1348,80 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
> {
> char *text;
> int len = 0;
> + u64 next_seq;
> + u64 seq;
> + u32 idx;
> +
> + if (!buf) {
> + if (clear) {
> + logbuf_lock_irq();
> + clear_seq = log_next_seq;
> + clear_idx = log_next_idx;
> + logbuf_unlock_irq();
> + }
> + return 0;
> + }
---
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 4a07e7158898..33a1e45293a5 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1395,13 +1395,11 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
return 0;
}
-
text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL);
if (!text)
return -ENOMEM;
logbuf_lock_irq();
-
/*
* Find first record that fits, including all following records,
* into the user-provided buffer for this dump.
@@ -1436,7 +1434,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
int textlen;
textlen = msg_print_text(msg, true, text,
- LOG_LINE_MAX + PREFIX_MAX);
+ LOG_LINE_MAX + PREFIX_MAX);
if (textlen < 0) {
len = textlen;
break;
---
Other than that, looks OK to me.
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
-ss
Powered by blists - more mailing lists