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:	Mon, 2 Nov 2015 14:04:23 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Jiaxing Wang <hello.wjx@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] tracing: Apply tracer specific options from kernel
 command line.

On Sun, 18 Oct 2015 19:58:10 +0800
Jiaxing Wang <hello.wjx@...il.com> wrote:


> +static int __init apply_trace_boot_options(void)
> +{
> +	char *option;
> +	char *buf;
> +	char *str;
> +	size_t len;
> +
> +	if (trace_boot_options) {
> +		len = strlen(trace_boot_options);
> +
> +		buf = str = kmalloc(len + 1, GFP_KERNEL);
> +		if (!buf)
> +			return -ENOMEM;
> +
> +		memcpy(buf, trace_boot_options, len + 1);
> +
> +		while (str) {
> +			option = strsep(&str, ",");
> +			trace_set_options(&global_trace, option);
> +		}
> +
> +		kfree(buf);

Instead of allocating a buffer, do what I do in early_enable_events()
(see trace_events.c), where I put back the ',' after processing.

-- Steve

> +	}
> +
> +	return 0;
> +}
> +
>  static ssize_t
>  tracing_trace_options_write(struct file *filp, const char __user *ubuf,
>  			size_t cnt, loff_t *ppos)
> @@ -7153,12 +7185,7 @@ __init static int tracer_alloc_buffers(void)
>  	INIT_LIST_HEAD(&global_trace.events);
>  	list_add(&global_trace.list, &ftrace_trace_arrays);
>  
> -	while (trace_boot_options) {
> -		char *option;
> -
> -		option = strsep(&trace_boot_options, ",");
> -		trace_set_options(&global_trace, option);
> -	}
> +	apply_trace_boot_options();
>  
>  	register_snapshot_cmd();
>  

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