Re: [PATCH v15 16/18] trace-cmd: Basic infrastructure for host - guest timestamp synchronization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 28, 2019 at 5:08 PM Slavomir Kaslev
<slavomir.kaslev@xxxxxxxxx> wrote:
>
...
> > +       if (buf_size && payload && payload_size) {
> > +               if (*payload_size) {
> > +                       if (*payload_size != buf_size || *payload == NULL) {
> > +                               ret = -ENOMEM;
>
> Returning ENOMEM in this case is confusing. If this case is intended
> make it so that we don't allocate on each tracecmd_msg_recv_time_sync,
> maybe do realloc() here instead?
>
The main use case is to avoid the memory allocation at all, if the
payload is with known size. The user can pass a buffer with given
size, and the error should handle the case when the payload size is
not the one, expected by the user.

> --
> Slavomir Kaslev

Thanks !

-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux