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, 01 Nov 2013 11:10:16 -0700
From:	Michael Hudson-Doyle <michael.hudson@...aro.org>
To:	Arnaldo Carvalho de Melo <acme@...hat.com>
Cc:	linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...hat.com>,
	Will Deacon <will.deacon@....com>,
	Jean Pihet <jean.pihet@...aro.org>
Subject: Re: [PATCH v2] perf tools: Remove cast of non-variadic function to variadic

Arnaldo Carvalho de Melo <acme@...hat.com> writes:

> Em Thu, Oct 31, 2013 at 04:47:45PM -0700, Michael Hudson-Doyle escreveu:
>> -int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent)
>> +int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...)
>>  {
>> -	const char *color = get_percent_color(percent);
>> +	va_list args;
>> +	double percent;
>> +	const char *color;
>> +
>> +	va_start(args, fmt);
>> +	percent = va_arg(args, double);
>> +	va_end(args);
>> +	color = get_percent_color(percent);
>>  	return color_snprintf(bf, size, color, fmt, percent);
>>  }
>
> As a bug fix I'm merging this now, but I wonder if, since we're doing
> the va_start/end dance here, can't we call some color_vsnprintf variant
> so as to avoid doing it twice?

I thought that, but we need to get the percent argument anyway.  I
couldn't decide if it was better to call color_vsnprintf with args or
color_snprintf with percent so I went for the laziest option / minimal
diff.  Can clearly write a patch for the alternative if you like...

> I'll look into that after going thru more urgent stuff.

Thanks!

Cheers,
mwh
--
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