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

Configure Feed

Select the types of activity you want to include in your feed.

usb: core: config: reverse the size check of the SSP isoc endpoint descriptor

Reverse the check of the size of the usb_ssp_isoc_ep_comp_descriptor
structure to be done before accessing the structure itself.
Functionally, this doesn't really do anything as the buffer is all
internal to the kernel, and reading off the end is just fine, but static
checking tools get picky when noticing that a potential read could be
made "outside" of an allocated buffer.

Not a bugfix, but a cleanup to keep tools from tripping over this
constantly and annoying me with their pointless reports.

Link: https://patch.msgid.link/2026040630-graded-postwar-760f@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+2 -2
+2 -2
drivers/usb/core/config.c
··· 54 54 * follows the SuperSpeed Endpoint Companion descriptor 55 55 */ 56 56 desc = (struct usb_ssp_isoc_ep_comp_descriptor *) buffer; 57 - if (desc->bDescriptorType != USB_DT_SSP_ISOC_ENDPOINT_COMP || 58 - size < USB_DT_SSP_ISOC_EP_COMP_SIZE) { 57 + if (size < USB_DT_SSP_ISOC_EP_COMP_SIZE || 58 + desc->bDescriptorType != USB_DT_SSP_ISOC_ENDPOINT_COMP) { 59 59 dev_notice(ddev, "Invalid SuperSpeedPlus isoc endpoint companion" 60 60 "for config %d interface %d altsetting %d ep %d.\n", 61 61 cfgno, inum, asnum, ep->desc.bEndpointAddress);