linux/drivers/usb
Niklas Neronin 1c80787ecd usb: xhci: correct debug message page size calculation
[ Upstream commit 55741c7233 ]

The ffs() function returns the index of the first set bit, starting from 1.
If no bits are set, it returns zero. This behavior causes an off-by-one
page size in the debug message, as the page size calculation [1]
is zero-based, while ffs() is one-based.

Fix this by subtracting one from the result of ffs(). Note that since
variable 'val' is unsigned, subtracting one from zero will result in the
maximum unsigned integer value. Consequently, the condition 'if (val < 16)'
will still function correctly.

[1], Page size: (2^(n+12)), where 'n' is the set page size bit.

Fixes: 81720ec532 ("usb: host: xhci: use ffs() in xhci_mem_init()")
Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20250306144954.3507700-9-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-04-10 14:33:36 +02:00
..
atm usb: atm: cxacru: fix a flaw in existing endpoint checks 2025-03-13 12:53:20 +01:00
c67x00 USB: c67x00: remove unnecessary check of res 2022-05-12 11:36:46 +02:00
cdns3 usb: cdns3: Add quirk flag to enable suspend residency 2024-12-27 13:52:51 +01:00
chipidea usb: chipidea: ci_hdrc_imx: decrement device's refcount in .remove() and in the error path of .probe() 2025-02-21 13:49:35 +01:00
class usb: cdc-acm: Fix handling of oversized fragments 2025-02-21 13:50:03 +01:00
common usb: ulpi: Fix debugfs directory leak 2024-02-23 09:12:34 +01:00
core usb: quirks: Add DELAY_INIT and NO_LPM for Prolific Mass Storage Card Reader 2025-03-13 12:53:20 +01:00
dwc2 usb: dwc2: gadget: remove of_node reference upon udc_stop 2025-02-21 13:50:02 +01:00
dwc3 usb: dwc3: gadget: Prevent irq storm when TH re-executes 2025-03-13 12:53:20 +01:00
early usb: early: xhci-dbc: Fix a potential out-of-bound memory access 2023-03-10 09:33:35 +01:00
gadget usb: gadget: uvc: Fix ERR_PTR dereference in uvc_v4l2.c 2025-04-07 10:05:46 +02:00
host usb: xhci: correct debug message page size calculation 2025-04-10 14:33:36 +02:00
image usb/image: fix repeated words in comments 2022-07-27 14:33:53 +02:00
isp1760 usb: isp1760: Fix out-of-bounds array access 2022-05-19 18:10:59 +02:00
misc USB: chaoskey: Fix possible deadlock chaoskey_list_lock 2024-12-14 19:53:53 +01:00
mon usb: mon: Fix atomicity violation in mon_bin_vma_fault 2024-01-25 15:27:40 -08:00
mtu3 usb: mtu3: fix kernel panic at qmu transfer done irq handler 2023-05-11 23:03:30 +09:00
musb usb: musb: Fix hardware lockup on first Rx endpoint request 2024-12-14 19:54:05 +01:00
phy usb: phy: Fix API devm_usb_put_phy() can not release the phy 2024-11-08 16:26:44 +01:00
renesas_usbhs usb: renesas_usbhs: Flush the notify_hotplug_work 2025-03-13 12:53:20 +01:00
roles usb: roles: set switch registered flag early on 2025-02-21 13:50:01 +01:00
serial USB: serial: option: match on interface class for Telit FN990B 2025-03-28 21:58:56 +01:00
storage usb-storage: Add max sectors quirk for Nokia 208 2025-01-17 13:34:44 +01:00
typec usb: typec: ucsi: Fix NULL pointer access 2025-04-07 10:05:46 +02:00
usbip usbip: Don't submit special requests twice 2024-09-08 07:53:10 +02:00
Kconfig usb: remove reference to deleted config STB03xxx 2021-08-18 15:32:19 +02:00
Makefile USB: xen-hcd: Traverse host/ when CONFIG_USB_XEN_HCD is selected 2024-06-21 14:35:43 +02:00
usb-skeleton.c usb: usb-skeleton: Update min() to min_t() 2021-10-05 12:56:48 +02:00