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:	Tue, 28 Oct 2014 10:58:31 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Joe Perches <joe@...ches.com>
Cc:	Al Viro <viro@...IV.linux.org.uk>, Petr Mladek <pmladek@...e.cz>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/7] debugfs: Fix misuse of seq_printf return value

On Mon, 29 Sep 2014 16:08:26 -0700
Joe Perches <joe@...ches.com> wrote:

> Adding repeated -1 to the return is not correct.
> 
> Use seq_is_full to test for unnecessary seq_printf uses
> and always return 0.

Actually, debugfs_print_regs32() should return void as well.
I'll update that.

Thanks,

-- Steve

> 
> Signed-off-by: Joe Perches <joe@...ches.com>
> ---
>  fs/debugfs/file.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> index 76c08c2..c24e578 100644
> --- a/fs/debugfs/file.c
> +++ b/fs/debugfs/file.c
> @@ -695,15 +695,17 @@ EXPORT_SYMBOL_GPL(debugfs_create_u32_array);
>  int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
>  			   int nregs, void __iomem *base, char *prefix)
>  {
> -	int i, ret = 0;
> +	int i;
>  
>  	for (i = 0; i < nregs; i++, regs++) {
> -		if (prefix)
> -			ret += seq_printf(s, "%s", prefix);
> -		ret += seq_printf(s, "%s = 0x%08x\n", regs->name,
> -				  readl(base + regs->offset));
> +		seq_printf(s, "%s%s = 0x%08x\n",
> +			   prefix ? prefix : "",
> +			   regs->name, readl(base + regs->offset));
> +		if (seq_is_full(s))
> +			break;
>  	}
> -	return ret;
> +
> +	return 0;
>  }
>  EXPORT_SYMBOL_GPL(debugfs_print_regs32);
>  

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