Re: [PATCH -next 1/2] seq_puts: Convert to return void and convert uses too.

From: Petr Mladek
Date: Tue Nov 11 2014 - 08:38:43 EST


On Mon 2014-11-10 10:58:56, Joe Perches wrote:
> diff --git a/ipc/util.c b/ipc/util.c
> index 106bed0..4f726b7 100644
> --- a/ipc/util.c
> +++ b/ipc/util.c
> @@ -837,8 +837,10 @@ static int sysvipc_proc_show(struct seq_file *s, void *it)
> struct ipc_proc_iter *iter = s->private;
> struct ipc_proc_iface *iface = iter->iface;
>
> - if (it == SEQ_START_TOKEN)
> - return seq_puts(s, iface->header);
> + if (it == SEQ_START_TOKEN) {
> + seq_puts(s, iface->header);
> + return seq_has_overflowed(s);

It should return 0. The overflow is detected by traverse() that is
called from seq_read(). If the overflow happens, the size of the
buffer is increased and show() is called again.

> + }
>
> return iface->show(s, it);

This should stay as is. It seems that the show() function might also
return negative value in case of some other failure. See the error
handling of "error = m->op->show(m, p);" in traverse() in fs/seq_file.c


The rest of the patch looks fine.

Best Regards,
Petr
--
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/