Skip to content

Commit f8e5f90

Browse files
committed
ALSA: usb-audio: Fix endianess in descriptor validation
I overlooked that some fields are words and need the converts from LE in the recently added USB descriptor validation code. This patch fixes those with the proper macro usages. Fixes: 57f8770 ("ALSA: usb-audio: More validations of descriptor units") Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 78be222 commit f8e5f90

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sound/usb/validate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static bool validate_processing_unit(const void *p,
110110
default:
111111
if (v->type == UAC1_EXTENSION_UNIT)
112112
return true; /* OK */
113-
switch (d->wProcessType) {
113+
switch (le16_to_cpu(d->wProcessType)) {
114114
case UAC_PROCESS_UP_DOWNMIX:
115115
case UAC_PROCESS_DOLBY_PROLOGIC:
116116
if (d->bLength < len + 1) /* bNrModes */
@@ -125,7 +125,7 @@ static bool validate_processing_unit(const void *p,
125125
case UAC_VERSION_2:
126126
if (v->type == UAC2_EXTENSION_UNIT_V2)
127127
return true; /* OK */
128-
switch (d->wProcessType) {
128+
switch (le16_to_cpu(d->wProcessType)) {
129129
case UAC2_PROCESS_UP_DOWNMIX:
130130
case UAC2_PROCESS_DOLBY_PROLOCIC: /* SiC! */
131131
if (d->bLength < len + 1) /* bNrModes */
@@ -142,7 +142,7 @@ static bool validate_processing_unit(const void *p,
142142
len += 2; /* wClusterDescrID */
143143
break;
144144
}
145-
switch (d->wProcessType) {
145+
switch (le16_to_cpu(d->wProcessType)) {
146146
case UAC3_PROCESS_UP_DOWNMIX:
147147
if (d->bLength < len + 1) /* bNrModes */
148148
return false;

0 commit comments

Comments
 (0)