mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
xhci: fix uninitialized string returned by xhci_decode_ctrl_ctx()
xhci_decode_ctrl_ctx() returns the untouched buffer as-is if both "drop" and "add" parameters are zero. Fix the function to return an empty string in that case. It was not immediately clear from the possible call chains whether this issue is currently actually triggerable or not. Note that before commit4843b4b5ec
("xhci: fix even more unsafe memory usage in xhci tracing") the result effect in the failure case was different as a static buffer was used here, but the code still worked incorrectly. Fixes:90d6d5731d
("xhci: Add tracing for input control context") Cc: stable@vger.kernel.org Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> commit4843b4b5ec
("xhci: fix even more unsafe memory usage in xhci tracing") Link: https://lore.kernel.org/r/20220303110903.1662404-4-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3105bc977d
commit
05519b8589
1 changed files with 2 additions and 0 deletions
|
@ -2468,6 +2468,8 @@ static inline const char *xhci_decode_ctrl_ctx(char *str,
|
|||
unsigned int bit;
|
||||
int ret = 0;
|
||||
|
||||
str[0] = '\0';
|
||||
|
||||
if (drop) {
|
||||
ret = sprintf(str, "Drop:");
|
||||
for_each_set_bit(bit, &drop, 32)
|
||||
|
|
Loading…
Reference in a new issue