The 'dimen' member of 'struct snd_ctl_elem_info' is designed to deliver information to use an array of value as multi-dimensional values. This feature is used just by echoaudio PCI driver, and fortunately it's not used by the other applications than 'echomixer' in alsa-tools. In a previous commit, usage of 'dimen' member is removed from echoaudio PCI driver. Nowadays no driver/application use the feature. This commit removes the member from structure.
Unified · Split
| @@ -1040,11 +1040,7 @@ struct snd_ctl_elem_info { · 1039 unmodified lines | |||
| 1040 | } enumerated; | 1040 | } enumerated; |
| 1041 | unsigned char reserved[128]; | 1041 | unsigned char reserved[128]; |
| 1042 | } value; | 1042 | } value; |
| 1043 | union { | 1043 | unsigned char reserved[64]; |
| 1044 | unsigned short d[4]; /* dimensions */ | ||
| 1045 | unsigned short *d_ptr; /* indirect - obsoleted */ | ||
| 1046 | } dimen; | ||
| 1047 | unsigned char reserved[64-4*sizeof(unsigned short)]; | ||
| 1048 | }; | 1044 | }; |
| 1049 | 1045 | ||
| 1050 | struct snd_ctl_elem_value { | 1046 | struct snd_ctl_elem_value { |
| @@ -758,36 +758,6 @@ static int snd_ctl_elem_list(struct snd_card *card, · 757 unmodified lines | |||
| 758 | return err; | 758 | return err; |
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | static bool validate_element_member_dimension(struct snd_ctl_elem_info *info) | ||
| 762 | { | ||
| 763 | unsigned int members; | ||
| 764 | unsigned int i; | ||
| 765 | |||
| 766 | if (info->dimen.d[0] == 0) | ||
| 767 | return true; | ||
| 768 | |||
| 769 | members = 1; | ||
| 770 | for (i = 0; i < ARRAY_SIZE(info->dimen.d); ++i) { | ||
| 771 | if (info->dimen.d[i] == 0) | ||
| 772 | break; | ||
| 773 | members *= info->dimen.d[i]; | ||
| 774 | |||
| 775 | /* | ||
| 776 | * info->count should be validated in advance, to guarantee | ||
| 777 | * calculation soundness. | ||
| 778 | */ | ||
| 779 | if (members > info->count) | ||
| 780 | return false; | ||
| 781 | } | ||
| 782 | |||
| 783 | for (++i; i < ARRAY_SIZE(info->dimen.d); ++i) { | ||
| 784 | if (info->dimen.d[i] > 0) | ||
| 785 | return false; | ||
| 786 | } | ||
| 787 | |||
| 788 | return members == info->count; | ||
| 789 | } | ||
| 790 | |||
| 791 | static int snd_ctl_elem_info(struct snd_ctl_file *ctl, | 761 | static int snd_ctl_elem_info(struct snd_ctl_file *ctl, |
| 792 | struct snd_ctl_elem_info *info) | 762 | struct snd_ctl_elem_info *info) |
| 793 | { | 763 | { |
| @@ -1280,8 +1250,6 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, · 486 unmodified lines | |||
| 1280 | if (info->count < 1 || | 1250 | if (info->count < 1 || |
| 1281 | info->count > max_value_counts[info->type]) | 1251 | info->count > max_value_counts[info->type]) |
| 1282 | return -EINVAL; | 1252 | return -EINVAL; |
| 1283 | if (!validate_element_member_dimension(info)) | ||
| 1284 | return -EINVAL; | ||
| 1285 | private_size = value_sizes[info->type] * info->count; | 1253 | private_size = value_sizes[info->type] * info->count; |
| 1286 | 1254 | ||
| 1287 | /* | 1255 | /* |