Re: [PATCH] vsprintf: drop comment claiming %n is ignored
From: Al Viro
Date: Sat Sep 14 2013 - 00:53:51 EST
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/