qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/5] usb: allow max 8192 bytes for desc


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 4/5] usb: allow max 8192 bytes for desc
Date: Tue, 11 Jan 2022 14:00:30 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0

On 1/5/22 08:25, zhenwei pi wrote:
> 
> On 1/4/22 11:22 PM, Philippe Mathieu-Daudé wrote:
>> On 27/12/21 15:27, zhenwei pi wrote:
>>> A device of USB video class usually uses larger desc structure, so
>>> use larger buffer to avoid failure.
>>>
>>> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
>>> ---
>>>   hw/usb/desc.c | 15 ++++++++-------
>>>   hw/usb/desc.h |  1 +
>>>   2 files changed, 9 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/hw/usb/desc.c b/hw/usb/desc.c
>>> index 8b6eaea407..7f6cc2f99b 100644
>>> --- a/hw/usb/desc.c
>>> +++ b/hw/usb/desc.c
>>> @@ -632,7 +632,8 @@ int usb_desc_get_descriptor(USBDevice *dev,
>>> USBPacket *p,
>>>       bool msos = (dev->flags & (1 << USB_DEV_FLAG_MSOS_DESC_IN_USE));
>>>       const USBDesc *desc = usb_device_get_usb_desc(dev);
>>>       const USBDescDevice *other_dev;
>>> -    uint8_t buf[256];
>>> +    size_t buflen = USB_DESC_MAX_LEN;
>>> +    g_autofree uint8_t *buf = g_malloc(buflen);
>>
>> Do we want to have a per-device desc_size (in USBDevice, default to
>> 256, video devices set it to 8K)?
>>
>> How "hot" is this path? Could we keep 8K on the stack?
>>
> It's an unlikely code path:
> 1, During guest startup, guest tries to probe device.
> 2, run 'lsusb' command in guest

If you have to respin, do you mind adding this 3 lines
in the description? Anyhow:

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]