diff mbox series

usb: host: xhci: use snprintf() in xhci_decode_trb()

Message ID 2dc0d93e-2ac7-3f5c-e22c-d5329ec2e7f5@omp.ru
State New
Headers show
Series usb: host: xhci: use snprintf() in xhci_decode_trb() | expand

Commit Message

Sergey Shtylyov March 16, 2022, 8:36 p.m. UTC
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")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
This patch is against the 'usb-next' branch of Greg KH's 'usb.git' repo.

 drivers/usb/host/xhci.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sergey Shtylyov May 17, 2022, 7:13 p.m. UTC | #1
Hello!

On 3/16/22 11:36 PM, Sergey Shtylyov wrote:

> 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")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> ---
> This patch is against the 'usb-next' branch of Greg KH's 'usb.git' repo.

   Mathias, Greg, what's going on with this patch? It was posted 2 months ago
and seemingly ignored... :-/

MBR, Sergey
Mathias Nyman May 18, 2022, 8:32 a.m. UTC | #2
On 17.5.2022 22.13, Sergey Shtylyov wrote:
> Hello!
> 
> On 3/16/22 11:36 PM, Sergey Shtylyov wrote:
> 
>> 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")
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>
>> ---
>> This patch is against the 'usb-next' branch of Greg KH's 'usb.git' repo.
> 
>     Mathias, Greg, what's going on with this patch? It was posted 2 months ago
> and seemingly ignored... :-/
> 
> MBR, Sergey

Must have missed it

I'll queue it up for 5.20 unless Greg still picks it up for 5.19.
Not urgent.

-Mathias
diff mbox series

Patch

Index: usb/drivers/usb/host/xhci.h
===================================================================
--- usb.orig/drivers/usb/host/xhci.h
+++ usb/drivers/usb/host/xhci.h
@@ -2391,7 +2391,7 @@  static inline const char *xhci_decode_tr
 			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),