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]
Date:	Thu, 8 May 2008 00:17:57 +0400
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Peter Oberparleiter <peter.oberparleiter@...ibm.com>,
	linux-kernel@...r.kernel.org, ltp-list@...ts.sourceforge.net,
	ltp-coverage@...ts.sourceforge.net,
	Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [RFC PATCH 4/6] seq_file: add function to write binary data

On Mon, May 05, 2008 at 09:36:44PM -0700, Andrew Morton wrote:
> On Mon, 05 May 2008 17:24:37 +0200 Peter Oberparleiter <peter.oberparleiter@...ibm.com> wrote:
> > --- linux-2.6.26-rc1.orig/fs/seq_file.c
> > +++ linux-2.6.26-rc1/fs/seq_file.c

> > +int seq_write(struct seq_file *m, const void *s, size_t len)

> > +{
> > +	if (m->count + len < m->size) {
> 
> Are you sure that shouldn't be >=?

No!

->count is how much bytes are already in buffer.
len is len.
->size is end of page(s).

> 
> > +		memcpy(m->buf + m->count, s, len);
> > +		m->count += len;
> > +		return 0;
> > +	}
> > +	m->count = m->size;
> > +	return -1;
> > +}
> > +EXPORT_SYMBOL(seq_write);

I'd call function seq_memcpy() though.

> This function has an upper limit of PAGE_SIZE bytes, I think?  The covering
> documentation should explain such things.

Again, no.

At first buffer is PAGE_SIZE. If output is bigger, ->count is dubbed to
->size, so when ->show() returns, size of buffer is doubled until it
fits in. See "while(1)" loop in seq_read().

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ