Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: core: devices: drop redundant buffer overflow checks

The USB device dump code often checks for the buffer overflow just before
calling the functions that do that first thing anyways. Such checks are
redundant and may be dropped...

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Link: https://lore.kernel.org/r/0453cb0d-7b2b-25e6-50e3-091610951e58@omp.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sergey Shtylyov and committed by
Greg Kroah-Hartman
08908fa1 9c1c0fdd

-12
-12
drivers/usb/core/devices.c
··· 228 228 229 229 start = usb_dump_interface_descriptor(start, end, intfc, iface, setno); 230 230 for (i = 0; i < desc->desc.bNumEndpoints; i++) { 231 - if (start > end) 232 - return start; 233 231 start = usb_dump_endpoint_descriptor(speed, 234 232 start, end, &desc->endpoint[i].desc); 235 233 } ··· 300 302 intfc = config->intf_cache[i]; 301 303 interface = config->interface[i]; 302 304 for (j = 0; j < intfc->num_altsetting; j++) { 303 - if (start > end) 304 - return start; 305 305 start = usb_dump_interface(speed, 306 306 start, end, intfc, interface, j); 307 307 } ··· 365 369 { 366 370 int i; 367 371 368 - if (start > end) 369 - return start; 370 - 371 372 start = usb_dump_device_descriptor(start, end, &dev->descriptor); 372 - 373 - if (start > end) 374 - return start; 375 373 376 374 start = usb_dump_device_strings(start, end, dev); 377 375 378 376 for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { 379 - if (start > end) 380 - return start; 381 377 start = usb_dump_config(dev->speed, 382 378 start, end, dev->config + i, 383 379 /* active ? */