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:	Mon, 17 Nov 2014 19:27:33 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Joe Perches <joe@...ches.com>
Cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jiri Kosina <jkosina@...e.cz>, Petr Mladek <pmladek@...e.cz>
Subject: Re: [PATCH 20/26 v5] seq_buf: Add seq_buf_can_fit() helper function

On Mon, 17 Nov 2014 16:07:33 -0800
Joe Perches <joe@...ches.com> wrote:

> On Mon, 2014-11-17 at 12:36 -0500, Steven Rostedt wrote:
> > On Fri, 14 Nov 2014 23:59:07 -0500
> > Steven Rostedt <rostedt@...dmis.org> wrote:
> > 
> > > From: "Steven Rostedt (Red Hat)" <rostedt@...dmis.org>
> > > 
> > > Add a seq_buf_can_fit() helper function that removes the possible mistakes
> > > of comparing the seq_buf length plus added data compared to the size of
> > > the buffer.
> []
> > > +static bool seq_buf_can_fit(struct seq_buf *s, size_t len)
> > > +{
> > > +	return s->len + len < s->size;
> > > +}
> > > +
> 
> Why is this useful?

Places the logic in one place and makes the next patch much shorter.

As the change log states, makes mistakes much less likely to happen
(note, I made one doing the next change and this makes me more
confident not to do another one)

-- Steve
--
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