diff options
| author | Jani Nikula <jani.nikula@intel.com> | 2025-06-09 12:40:46 +0300 | 
|---|---|---|
| committer | Jani Nikula <jani.nikula@intel.com> | 2025-06-09 12:40:46 +0300 | 
| commit | 34c55367af96f62e89221444f04487440ebc6487 (patch) | |
| tree | fdb36ba67d7dea09455b55037e26043b7e051ef9 /drivers/usb/core/usb.c | |
| parent | 7247efca0dcbc8ac6147db9200ed1549c0662465 (diff) | |
| parent | 19272b37aa4f83ca52bdf9c16d5d81bdd1354494 (diff) | |
| download | linux-34c55367af96f62e89221444f04487440ebc6487.tar.xz | |
Merge drm/drm-next into drm-intel-next
Sync to v6.16-rc1, among other things to get the fixed size GENMASK_U*()
and BIT_U*() macros.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/usb/core/usb.c')
| -rw-r--r-- | drivers/usb/core/usb.c | 14 | 
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 0b4685aad2d5..118fa4c93a79 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -695,15 +695,16 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,  		device_set_of_node_from_dev(&dev->dev, bus->sysdev);  		dev_set_name(&dev->dev, "usb%d", bus->busnum);  	} else { +		int n; +  		/* match any labeling on the hubs; it's one-based */  		if (parent->devpath[0] == '0') { -			snprintf(dev->devpath, sizeof dev->devpath, -				"%d", port1); +			n = snprintf(dev->devpath, sizeof(dev->devpath), "%d", port1);  			/* Root ports are not counted in route string */  			dev->route = 0;  		} else { -			snprintf(dev->devpath, sizeof dev->devpath, -				"%s.%d", parent->devpath, port1); +			n = snprintf(dev->devpath, sizeof(dev->devpath), "%s.%d", +				     parent->devpath, port1);  			/* Route string assumes hubs have less than 16 ports */  			if (port1 < 15)  				dev->route = parent->route + @@ -712,6 +713,11 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,  				dev->route = parent->route +  					(15 << ((parent->level - 1)*4));  		} +		if (n >= sizeof(dev->devpath)) { +			usb_put_hcd(bus_to_hcd(bus)); +			usb_put_dev(dev); +			return NULL; +		}  		dev->dev.parent = &parent->dev;  		dev_set_name(&dev->dev, "%d-%s", bus->busnum, dev->devpath);  | 
