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:	Wed, 02 Dec 2009 11:45:45 -0500
From:	Masami Hiramatsu <mhiramat@...hat.com>
To:	Liming Wang <liming.wang@...driver.com>
CC:	Ingo Molnar <mingo@...e.hu>, fweisbec@...il.com,
	peterz@...radead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf tools: replace %m with %a in sscanf

Liming Wang wrote:
> Not all glibc support %m and it results in a compile error if
> %m not supported. Replace it with %a and (float *) casts.
> 
> Signed-off-by: Liming Wang<liming.wang@...driver.com>
> Acked-by: Frederic Weisbecker<fweisbec@...il.com>
> ---
>   tools/perf/util/probe-event.c |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index e42f3ac..cd7fbda 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -199,8 +199,8 @@ void parse_trace_kprobe_event(const char *str, char **group, char **event,
>   		semantic_error("Too less arguments.");
> 
>   	/* Scan event and group name. */
> -	ret = sscanf(argv[0], "%c:%m[^/ \t]/%m[^ \t]",
> -		&pr, group, event);
> +	ret = sscanf(argv[0], "%c:%a[^/ \t]/%a[^ \t]",
> +		&pr, (float *)(void *)group, (float *)(void *)event);

Hmm, the code itself is OK for me, but I think we need a comment
why we cast (void *) to (float *)...

Thank you,

>   	if (ret != 3)
>   		semantic_error("Failed to parse event name: %s", argv[0]);
>   	pr_debug("Group:%s Event:%s probe:%c\n", *group, *event, pr);
> @@ -211,7 +211,7 @@ void parse_trace_kprobe_event(const char *str, char **group, char **event,
>   	pp->retprobe = (pr == 'r');
> 
>   	/* Scan function name and offset */
> -	ret = sscanf(argv[1], "%m[^+]+%d",&pp->function,&pp->offset);
> +	ret = sscanf(argv[1], "%a[^+]+%d", (float *)(void *)&pp->function,&pp->offset);
>   	if (ret == 1)
>   		pp->offset = 0;
> 

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: mhiramat@...hat.com

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