ALSA: usb-audio: Remove superfluous bLength checks
Now that we got the more comprehensive validation code for USB-audio descriptors, the check of overflow in each descriptor unit parser became superfluous. Drop some of the obvious cases. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -38,39 +38,37 @@ static void *find_uac_clock_desc(struct usb_host_interface *iface, int id,
|
||||
static bool validate_clock_source_v2(void *p, int id)
|
||||
{
|
||||
struct uac_clock_source_descriptor *cs = p;
|
||||
return cs->bLength == sizeof(*cs) && cs->bClockID == id;
|
||||
return cs->bClockID == id;
|
||||
}
|
||||
|
||||
static bool validate_clock_source_v3(void *p, int id)
|
||||
{
|
||||
struct uac3_clock_source_descriptor *cs = p;
|
||||
return cs->bLength == sizeof(*cs) && cs->bClockID == id;
|
||||
return cs->bClockID == id;
|
||||
}
|
||||
|
||||
static bool validate_clock_selector_v2(void *p, int id)
|
||||
{
|
||||
struct uac_clock_selector_descriptor *cs = p;
|
||||
return cs->bLength >= sizeof(*cs) && cs->bClockID == id &&
|
||||
cs->bLength == 7 + cs->bNrInPins;
|
||||
return cs->bClockID == id;
|
||||
}
|
||||
|
||||
static bool validate_clock_selector_v3(void *p, int id)
|
||||
{
|
||||
struct uac3_clock_selector_descriptor *cs = p;
|
||||
return cs->bLength >= sizeof(*cs) && cs->bClockID == id &&
|
||||
cs->bLength == 11 + cs->bNrInPins;
|
||||
return cs->bClockID == id;
|
||||
}
|
||||
|
||||
static bool validate_clock_multiplier_v2(void *p, int id)
|
||||
{
|
||||
struct uac_clock_multiplier_descriptor *cs = p;
|
||||
return cs->bLength == sizeof(*cs) && cs->bClockID == id;
|
||||
return cs->bClockID == id;
|
||||
}
|
||||
|
||||
static bool validate_clock_multiplier_v3(void *p, int id)
|
||||
{
|
||||
struct uac3_clock_multiplier_descriptor *cs = p;
|
||||
return cs->bLength == sizeof(*cs) && cs->bClockID == id;
|
||||
return cs->bClockID == id;
|
||||
}
|
||||
|
||||
#define DEFINE_FIND_HELPER(name, obj, validator, type) \
|
||||
|
||||
Reference in New Issue
Block a user