lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161031085147.GN12522@suse.cz>
Date:   Mon, 31 Oct 2016 09:51:47 +0100
From:   David Sterba <dsterba@...e.cz>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Chris Mason <clm@...com>, Josef Bacik <jbacik@...com>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Joe Perches <joe@...ches.com>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, linux-kernel@...r.kernel.org,
        Jason Wessel <jason.wessel@...driver.com>
Subject: Re: [PATCH 1/4] printk/NMI: Handle continuous lines and missing
 newline

On Thu, Oct 27, 2016 at 05:52:51PM +0200, Petr Mladek wrote:
> +static int printk_nmi_flush_buffer(unsigned char *start, size_t len)
>  {
> -	const char *buf = s->buffer + start;
> +	unsigned char *c, *end;
> +	bool header;
> +
> +	c = start;
> +	end = start + len;
> +	header = true;
> +
> +	/* Print line by line. */
> +	while (c < end) {
> +		if (*c == '\n') {
> +			printk_nmi_flush_line(start, c - start + 1);
> +			start = ++c;
> +			header = true;
> +			continue;
> +		}
>  
> -	printk_nmi_flush_line(buf, (end - start) + 1);
> +		/* Handle continuous lines or missing new line. */
> +		if ((c + 1 < end) && printk_get_level(c)) {
> +			if (header) {
> +				c += 2;
> +				continue;
> +			}
> +
> +			printk_nmi_flush_line(start, c - start);
> +			start = c++;
> +			header = true;
> +			continue;
> +		}
> +
> +		header = false;
> +		c++;
> +	}
> +
> +	/* Check if there was a partial line. Ignore pure header. */
> +	if (start < end && !header) {
> +		printk_nmi_flush_line(start, end - start);
> +		printk_nmi_flush_line("\n", strlen("\n"));

Not introduced by this patch as it was in the original code and the
compiler is smart enough to replace strlen("\n") with 1, but still it
looks strange.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ