Re: [PATCH v4] ucm: add cset-tlv

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

 



On Wed, 13 Apr 2016 12:15:45 +0200,
Hsin-yu Chao wrote:
> 
> On Wed, Apr 13, 2016 at 6:02 PM, Takashi Iwai <tiwai@xxxxxxx> wrote:
> > On Wed, 13 Apr 2016 10:57:40 +0200,
> > Vinod Koul wrote:
> >>
> >> On Wed, Apr 13, 2016 at 02:26:57PM +0800, Hsin-Yu Chao wrote:
> >> > +   sz_read = read(fd, *res, sz);
> >> > +   if (sz_read < 0 || (size_t)sz_read != sz) {
> >> > +           err = -EIO;
> >> > +           free(*res);
> >> > +           *res = NULL;
> >> > +   }
> >> > +   /* Check if the tlv file specifies valid size. */
> >> > +   tlv = (unsigned int *)(*res);
> >> > +   if (tlv[1] + 2 * sizeof(unsigned int) != sz) {
> >>
> >> why not use snd_ctl_tlv(), my assumption is that you are expecting a type,
> >> length and values in the buffer
> >
> > Actually this implicitly checks the endianess of the read data.
> >
> >
> > Takashi
> Thanks for this useful info!
> I read the comment regarding the length of this snd_ctl_tlv struct,
> saying that "in bytes aligned to 4", but I don't see anywhere in the
> tlv_write path asserts this.
> Should I also add a check here that files size is a multiple of 4?

Yes, it makes sense.


thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux