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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 11 Apr 2023 23:24:27 +0900
From:   Sergey Senozhatsky <senozhatsky@...omium.org>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Sergey Senozhatsky <senozhatsky@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Yosry Ahmed <yosryahmed@...gle.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] seq_buf: add seq_buf_printk() helper

On (23/04/11 14:14), Petr Mladek wrote:
> We might want to somehow distinguish that this is actually
> printing (reading) the context of the buffer.
> 
> The name is similar to seq_buf_printf() and seq_buf_vprintf()
> whose are wrinting into the buffer.
> 
> What about the following?
> 
>      + seq_buf_printf_seq() like the existing seq_buf_print_seq()
>      + seq_buf_to_printk() like the existing seq_buf_to_user()
> 
> I personally prefer seq_buf_to_printk() because it looks more
> selfexplaining to me.

I like seq_buf_to_printk().

> > +{
> > +	const char *start, *lf;
> > +	int len;
> > +
> > +	if (s->size == 0)
> > +		return;
> > +
> > +	start = s->buffer;
> > +	while ((lf = strchr(start, '\n'))) {
> 
> We should rather use strnchr(). It seems that the trailing '\0' is
> not guaranteed. For example, seq_buf_putc() just adds the given
> character at the end.

Good point.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ