public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xhci: Fix bcdUSB initialization
@ 2025-02-27 19:34 Abhishek Tamboli
  2025-02-27 19:36 ` Greg KH
  2025-02-27 20:15 ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Abhishek Tamboli @ 2025-02-27 19:34 UTC (permalink / raw)
  To: mathias.nyman, gregkh; +Cc: linux-usb, linux-kernel, dan.carpenter

Initialize bcdUSB to 0 to prevent undefined behaviour
if accessed without being explicitly set.

Fix the following smatch error:
drivers/usb/host/xhci-hub.c:71 xhci_create_usb3x_bos_desc()
error: uninitialized symbol 'bcdUSB'

Signed-off-by: Abhishek Tamboli <abhishektamboli9@gmail.com>
---
 drivers/usb/host/xhci-hub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 9693464c0520..5715a8bdda7f 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -39,7 +39,7 @@ static int xhci_create_usb3x_bos_desc(struct xhci_hcd *xhci, char *buf,
 	struct usb_ss_cap_descriptor	*ss_cap;
 	struct usb_ssp_cap_descriptor	*ssp_cap;
 	struct xhci_port_cap		*port_cap = NULL;
-	u16				bcdUSB;
+	u16				bcdUSB = 0;
 	u32				reg;
 	u32				min_rate = 0;
 	u8				min_ssid;
--
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-27 20:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27 19:34 [PATCH] xhci: Fix bcdUSB initialization Abhishek Tamboli
2025-02-27 19:36 ` Greg KH
2025-02-27 20:11   ` Abhishek Tamboli
2025-02-27 20:16   ` Dan Carpenter
2025-02-27 20:15 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox