On Tue, 26 Jan 2021 17:25:24 +0100, Jaroslav Kysela wrote: > > Dne 26. 01. 21 v 16:57 Takashi Iwai napsal(a): > > > @@ -1226,11 +1227,18 @@ struct user_element { > > struct snd_card *card; > > char *elem_data; /* element data */ > > unsigned long elem_data_size; /* size of element data in bytes */ > > + size_t alloc_size; /* allocated size */ > > I think that introduction of this new member is not required. The allocated > size can be easily computed at runtime (function). True. OTOH, I thought this addition would be error-prone. > > @@ -1397,6 +1414,7 @@ static int snd_ctl_elem_init_enum_names(struct user_element *ue) > > > > ue->priv_data = names; > > ue->info.value.enumerated.names_ptr = 0; > > + ue->alloc_size += buf_len; > > The buf_len variable is the remaining count. The > ue->info.value.enumerated.names_length already contains allocated bytes. This > code can be elimited if alloc_size is not introduced. Oh yeah, that's a wrong count. thanks, Takashi