All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Namit Gupta <gupta.namit@samsung.com>
Cc: pmladek@suse.com, sergey.senozhatsky@gmail.com,
	rostedt@goodmis.org, linux-kernel@vger.kernel.org,
	pankaj.m@samsung.com, a.sahrawat@samsung.com,
	himanshu.m@samsung.com
Subject: Re: [PATCH] printk: remove unnecessary kmalloc() from syslog during clear
Date: Thu, 21 Jun 2018 15:58:02 +0900	[thread overview]
Message-ID: <20180621065802.GA495@jagdpanzerIV> (raw)
In-Reply-To: <20180620135951epcas5p3bd2a8f25ec689ca333bce861b527dba2~54wyKcT0_3155531555epcas5p3y@epcas5p3.samsung.com>

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@gmail.com>

	-ss

  parent reply	other threads:[~2018-06-21  6:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180620135951epcas5p3bd2a8f25ec689ca333bce861b527dba2@epcas5p3.samsung.com>
2018-06-20 13:56 ` [PATCH] printk: remove unnecessary kmalloc() from syslog during clear Namit Gupta
2018-06-20 14:16   ` Steven Rostedt
2018-06-21  6:58   ` Sergey Senozhatsky [this message]
2018-06-25 13:37   ` Petr Mladek
2018-06-25 13:42     ` Jiri Kosina
2018-06-25 14:35     ` Sergey Senozhatsky
2018-06-25 14:37     ` Steven Rostedt
2018-06-25 14:44       ` Sergey Senozhatsky
2018-06-26 12:43         ` Petr Mladek
2018-06-26 14:39           ` Steven Rostedt
2018-06-27 15:06             ` Petr Mladek
2018-07-09 11:48               ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180621065802.GA495@jagdpanzerIV \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=a.sahrawat@samsung.com \
    --cc=gupta.namit@samsung.com \
    --cc=himanshu.m@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pankaj.m@samsung.com \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.