TencentOS-kernel/drivers/usb
Peter Chen b02ecfbda0 usb: cdns3: gadget: suspicious implicit sign extension
[ Upstream commit 5fca3f062879f8e5214c56f3e3e2be6727900f5d ]

The code:
trb->length = cpu_to_le32(TRB_BURST_LEN(priv_ep->trb_burst_size)
	       	| TRB_LEN(length));

TRB_BURST_LEN(priv_ep->trb_burst_size) may be overflow for int 32 if
priv_ep->trb_burst_size is equal or larger than 0x80;

Below is the Coverity warning:
sign_extension: Suspicious implicit sign extension: priv_ep->trb_burst_size
with type u8 (8 bits, unsigned) is promoted in priv_ep->trb_burst_size << 24
to type int (32 bits, signed), then sign-extended to type unsigned long
(64 bits, unsigned). If priv_ep->trb_burst_size << 24 is greater than 0x7FFFFFFF,
the upper bits of the result will all be 1.

To fix it, it needs to add an explicit cast to unsigned int type for ((p) << 24).

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-16 16:40:27 +08:00
..
atm Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
c67x00 USB: c67x00: fix use after free in c67x00_giveback_urb 2021-03-16 16:32:07 +08:00
cdns3 usb: cdns3: gadget: suspicious implicit sign extension 2021-03-16 16:40:27 +08:00
chipidea usb: chipidea: core: add wakeup support for extcon 2021-03-16 16:32:08 +08:00
class usb: cdc-acm: fix cooldown mechanism 2021-03-16 16:40:02 +08:00
common Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
core usb: core: Solve race condition in anchor cleanup functions 2021-03-16 16:39:24 +08:00
dwc2 usb: dwc2: Fix INTR OUT transfers in DDMA mode. 2021-03-16 16:38:45 +08:00
dwc3 usb: dwc3: gadget: END_TRANSFER before CLEAR_STALL command 2021-03-16 16:40:02 +08:00
early USB: early: Handle AMD's spec-compliant identifiers, too 2021-03-16 16:26:55 +08:00
gadget usb: gadget: f_ncm: allow using NCM in SuperSpeed Plus gadgets. 2021-03-16 16:39:27 +08:00
host usb: host: fsl-mph-dr-of: check return of dma_set_mask() 2021-03-16 16:40:03 +08:00
image Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
isp1760 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
misc USB: adutux: fix debugging 2021-03-16 16:39:47 +08:00
mon Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mtu3 usb: mtu3: clear dual mode of u3port when disable device 2021-03-16 16:33:22 +08:00
musb usb: musb: Fix runtime PM imbalance on error 2021-03-16 16:28:52 +08:00
phy usb: phy: twl6030-usb: Fix a resource leak in an error handling path in 'twl6030_usb_probe()' 2021-03-16 16:28:29 +08:00
renesas_usbhs usb: renesas_usbhs: getting residue from callback_result 2021-03-16 16:31:01 +08:00
roles Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
serial USB: serial: ftdi_sio: add support for FreeCalypso JTAG+UART adapters 2021-03-16 16:38:10 +08:00
storage USB: UAS: fix disconnect by unplugging a hub 2021-03-16 16:36:19 +08:00
typec usb: typec: tcpm: reset hard_reset_count for any disconnect 2021-03-16 16:40:03 +08:00
usbip Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kconfig Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Makefile Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
usb-skeleton.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00