Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1242125

Re: [PATCH v9 1/4] perf,kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h

From Hemant Kumar <hemant@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v9 1/4] perf,kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h
Date 2015-10-08 11:50 +0200
Message-ID <qhfZL-88e-9@gated-at.bofh.it> (permalink)
References <qgMEq-8aB-3@gated-at.bofh.it> <qgZBE-1xt-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi David,


On 10/07/2015 09:41 PM, David Ahern wrote:
> On 10/6/15 8:25 PM, Hemant Kumar wrote:
>> @@ -358,7 +357,12 @@ static bool handle_end_event(struct 
>> 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);
>
> decode can still be a stack variable even with variable length.
>

Yeah, we can do that. But, I am not sure whether its a standard way.

>> +
>> +        if (!decode) {
>> +            pr_err("Not enough memory\n");
>> +            return false;
>> +        }
>>
>>           kvm->events_ops->decode_key(kvm, &event->key, decode);
>>           if (!skip_event(decode)) {
>> @@ -366,6 +370,7 @@ static bool handle_end_event(struct perf_kvm_stat 
>> *kvm,
>>                    sample->time, sample->pid, vcpu_record->vcpu_id,
>>                    decode, time_diff/1000);
>>           }
>> +        free(decode);
>>       }
>>
>>       return update_kvm_event(event, vcpu, time_diff);
>> @@ -386,7 +391,8 @@ struct vcpu_event_record *per_vcpu_record(struct 
>> thread *thread,
>
> -----8<-----
>
>> @@ -575,7 +581,7 @@ static void show_timeofday(void)
>>
>>   static void print_result(struct perf_kvm_stat *kvm)
>>   {
>> -    char decode[DECODE_STR_LEN];
>> +    char *decode;
>
> and a stack variable here too.
>

Same here.

> David
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

-- 
Thanks,
Hemant Kumar

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v9 1/4] perf,kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h Hemant Kumar <hemant@linux.vnet.ibm.com> - 2015-10-07 04:30 +0200
  Re: [PATCH v9 1/4] perf,kvm/{x86,s390}: Remove dependency on  uapi/kvm_perf.h David Ahern <dsahern@gmail.com> - 2015-10-07 18:20 +0200
    Re: [PATCH v9 1/4] perf,kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h Hemant Kumar <hemant@linux.vnet.ibm.com> - 2015-10-08 11:50 +0200

csiph-web