Skip to contentSkip to conversation

xhci feature for usb-next

PATCH New Mathias Nyman 1 participant 2 messages Jun 30, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover xhci feature for usb-next

Hi Greg

A very small change that was sitting in my for-usb-next branch for a while.

Thanks
Mathias

Sergey Shtylyov (1):
usb: host: xhci: use snprintf() in xhci_decode_trb()

 drivers/usb/host/xhci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 usb: host: xhci: use snprintf() in xhci_decode_trb()

From: Sergey Shtylyov <[email protected]>

Commit cbf286e8ef83 ("xhci: fix unsafe memory usage in xhci tracing") apparently missed one sprintf() call in xhci_decode_trb() -- replace it with the snprintf() call as well...

Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.

Fixes cbf286e8ef83 ("xhci: fix unsafe memory usage in xhci tracing")
---
 drivers/usb/host/xhci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.h +1 -1
index 28aaf031f9a8..1960b47acfb2 100644
@@ -2417,7 +2417,7 @@ static inline const char *xhci_decode_trb(char *str, size_t size,
 			field3 & TRB_CYCLE ? 'C' : 'c');
 		break;
 	case TRB_STOP_RING:
-		sprintf(str,
+		snprintf(str, size,
 			"%s: slot %d sp %d ep %d flags %c",
 			xhci_trb_type_string(type),
 			TRB_TO_SLOT_ID(field3),
Signature · 1 line
2.25.1