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:	Fri, 14 Nov 2014 14:17:28 +0100
From:	Petr Mladek <pmladek@...e.cz>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jiri Kosina <jkosina@...e.cz>
Subject: Re: [RFC][PATCH 12/23 v4] tracing: Remove return values of most
 trace_seq_*() functions

On Thu 2014-11-13 20:12:56, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <rostedt@...dmis.org>
> 
> The trace_seq_printf() and friends are used to store strings into a buffer
> that can be passed around from function to function. If the trace_seq buffer
> fills up, it will not print any more. The return values were somewhat
> inconsistant and using trace_seq_has_overflowed() was a better way to know
> if the write to the trace_seq buffer succeeded or not.
> 
> Now that all users have removed reading the return value of the printf()
> type functions, they can safely return void and keep future users of them
> from reading the inconsistent values as well.
> 
> Signed-off-by: Steven Rostedt <rostedt@...dmis.org>
> ---
>  include/linux/trace_seq.h | 37 +++++++++------------
>  kernel/trace/trace_seq.c  | 84 +++++++++++++----------------------------------
>  2 files changed, 37 insertions(+), 84 deletions(-)

[...]

> diff --git a/kernel/trace/trace_seq.c b/kernel/trace/trace_seq.c
> index b100994a17fe..e54c0a1fb3f0 100644
> --- a/kernel/trace/trace_seq.c
> +++ b/kernel/trace/trace_seq.c

[...]

> @@ -303,20 +269,17 @@ EXPORT_SYMBOL_GPL(trace_seq_putmem);
>   * This is similar to trace_seq_putmem() except instead of just copying the
>   * raw memory into the buffer it writes its ASCII representation of it
>   * in hex characters.
> - *
> - * Returns how much it wrote to the buffer.
>   */
> -int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
> +void trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
>  			 unsigned int len)
>  {
>  	unsigned char hex[HEX_CHARS];
>  	const unsigned char *data = mem;
>  	unsigned int start_len;
>  	int i, j;
> -	int cnt = 0;
>  
>  	if (s->full)
> -		return 0;
> +		return;
>  
>  	while (len) {
>  		start_len = min(len, HEX_CHARS - 1);
> @@ -334,10 +297,7 @@ int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
>  		/* j increments twice per loop */
>  		len -= j / 2;
>  		hex[j++] = ' ';
> -
> -		cnt += trace_seq_putmem(s, hex, j);

trace_seq_putmem(s, hex, j); should stay ;-)

Best Regards,
Petr

>  	}
> -	return cnt;
>  }
>  EXPORT_SYMBOL_GPL(trace_seq_putmem_hex);
>  
> -- 
> 2.1.1
> 
> 
--
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