提交 0e518546 编写于 作者: S Sergey Shtylyov 提交者: Zheng Zengkai

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

stable inclusion
from stable-v5.10.137
commit b840c2926de2fbfcfef72c4373ef9d8057867349
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b840c2926de2fbfcfef72c4373ef9d8057867349

--------------------------------

[ Upstream commit 1ce69c35 ]

Commit cbf286e8 ("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: cbf286e8 ("xhci: fix unsafe memory usage in xhci tracing")
Signed-off-by: NSergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20220630124645.1805902-2-mathias.nyman@linux.intel.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 90fdffce
...@@ -2385,7 +2385,7 @@ static inline const char *xhci_decode_trb(char *str, size_t size, ...@@ -2385,7 +2385,7 @@ static inline const char *xhci_decode_trb(char *str, size_t size,
field3 & TRB_CYCLE ? 'C' : 'c'); field3 & TRB_CYCLE ? 'C' : 'c');
break; break;
case TRB_STOP_RING: case TRB_STOP_RING:
sprintf(str, snprintf(str, size,
"%s: slot %d sp %d ep %d flags %c", "%s: slot %d sp %d ep %d flags %c",
xhci_trb_type_string(type), xhci_trb_type_string(type),
TRB_TO_SLOT_ID(field3), TRB_TO_SLOT_ID(field3),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册