[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130914045313.GB13318@ZenIV.linux.org.uk>
Date: Sat, 14 Sep 2013 05:53:14 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc: keescook@...omium.org, joe@...ches.com, linux@...izon.com,
akpm@...ux-foundation.org, dan.carpenter@...cle.com,
davem@...emloft.net, eldad@...refinery.com, jbeulich@...e.com,
jkosina@...e.cz, linux-kernel@...r.kernel.org,
rdunlap@...radead.org
Subject: Re: [PATCH] vsprintf: drop comment claiming %n is ignored
On Sat, Sep 14, 2013 at 04:48:02AM +0100, Al Viro wrote:
> Overall: I suspect that Joe might be right. The very few callers that
> use the return value and use it correctly can bloody well call
> seq_overflow(), preferably with a detailed comment about the reasons
> for doing so. Anything that really wants the length of output (if we
> have such places at all) can use %n or see Figure 1. I haven't
> crawled through lib/*, net/* and sound/* yet, but that's how the things
> look so far.
The same goes for seq_puts, seq_escape, seq_vprintf, seq_dentry,
seq_bitmap*, seq_cpumask*, seq_nodemask*, seq_putc, seq_put_decimal*
seq_puts() has one buggy user trying to return its return value from
->show(). seq_putc() has several such.
seq_path() returns length and in one case its return value is used
(right-padded pathname in /proc/swaps).
seq_path_root() returns what would be a valid return value for ->show()
(0 or 1, actually).
seq_write() return value is mostly ignored; kernel/trace/* is using it
to check for overflows, but its reaction to said overflows is odd.
The bottom line: most of these guys could as well return void; we have
few overflow checks and those could be made explicit. As it is,
"return -1 on overflow" had been a mistake. Mea culpa.
--
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