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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150601132803.GA2348@redhat.com>
Date:	Mon, 1 Jun 2015 10:28:03 -0300
From:	Arnaldo Carvalho de Melo <acme@...hat.com>
To:	Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...hat.com>,
	Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
	Michael Ellerman <mpe@...erman.id.au>
Subject: Re: [PATCH] perf/tool: remove newline char when reading event scale
 and unit

Em Sun, May 31, 2015 at 11:36:23AM +0530, Madhavan Srinivasan escreveu:
> commit <fd979c013207> intruduced perf_event_sysfs_show function to display
> event_str value of an attr in kernel/event/core.c. But the function returns
> the value with a newline char. So, if a event also carries a event.unit file,
> when printing the counter data perf tool formatting goes for a spin.
> That is, because of the event unit, event name is printed in the newline
> because of perf_event_sysfs_show returns with a newline char.
> 
> Now fixing perf core will break API, hencing proposing a fix in the perf tool.

Looks sensible, but please next time add spaces around operators, doing
it this time.

I.e., it should be:

		scale[sret - 1] = '\0';

Thanks,

- Arnaldo
  
> +	if (scale[sret-1] == '\n')
> +		scale[sret-1] = '\0';
> +	else
> +		scale[sret] = '\0';
> +
>  	/*
>  	 * save current locale
>  	 */
> @@ -154,7 +158,10 @@ static int perf_pmu__parse_unit(struct perf_pmu_alias *alias, char *dir, char *n
>  
>  	close(fd);
>  
> -	alias->unit[sret] = '\0';
> +	if (alias->unit[sret-1] == '\n')
> +		alias->unit[sret-1] = '\0';
> +	else
> +		alias->unit[sret] = '\0';
>  
>  	return 0;
>  error:
> -- 
> 1.9.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