Hemant Kumar writes:
Hi David,Well, I also vote for making them variable length arrays. I guess that
On 10/07/2015 09:41 PM, David Ahern wrote:
On 10/6/15 8:25 PM, Hemant Kumar wrote:Yeah, we can do that. But, I am not sure whether its a standard way.
@@ -358,7 +357,12 @@ static bool handle_end_event(structdecode can still be a stack variable even with variable length.
perf_kvm_stat *kvm,
time_diff = sample->time - time_begin;
if (kvm->duration && time_diff > kvm->duration) {
- char decode[DECODE_STR_LEN];
+ char *decode = zalloc(decode_str_len);
wouldn't be a problem because the "variable" here is actually a constant
compile time value, even if it's extern.
But if people are strongly against it, as an alternative I can suggest
to move the 'char *decode' variable to the perf_kvm_stat structure,
allocate it once e.g. in kvm_events_report() and just write to it via
decode_key(). If I'm not mistaken, we always write \0 trimmed strings,
so garbage after \0 shouldn't be a problem.
It's not a real problem anyway :)
For s390 parts:
Acked-by: Alexander Yarygin <yarygin@xxxxxxxxxxxxxxxxxx>
-----8<-----Same here.
@@ -575,7 +581,7 @@ static void show_timeofday(void)and a stack variable here too.
static void print_result(struct perf_kvm_stat *kvm)
{
- char decode[DECODE_STR_LEN];
+ char *decode;
David
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@xxxxxxxxxxxxxxxx
https://lists.ozlabs.org/listinfo/linuxppc-dev