diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-08-22 10:25:27 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-12 21:20:48 +0300 |
commit | 9feeaa50e5b4b0b71259d918a36ecf9059e60796 (patch) | |
tree | 9ad2eef74502c5898546c6591aed983f22514aaa /sound/usb/clock.c | |
parent | f0e164f66e7515d8e01ca1bf256107bd8a38d177 (diff) | |
download | linux-9feeaa50e5b4b0b71259d918a36ecf9059e60796.tar.xz |
ALSA: usb-audio: Remove superfluous bLength checks
commit b8e4f1fdfa422398c2d6c47bfb7d1feb3046d70a upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/usb/clock.c')
-rw-r--r-- | sound/usb/clock.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sound/usb/clock.c b/sound/usb/clock.c index db5e39d67a90..e31349865f20 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c @@ -52,39 +52,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) \ |