[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s |
Date: |
Wed, 09 Mar 2016 13:52:42 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Peter Xu <address@hidden> writes:
> On Wed, Mar 09, 2016 at 09:34:50AM +0100, Markus Armbruster wrote:
>> Peter Xu <address@hidden> writes:
>> > It's dynamically allocated in stack, can we still use ARRAY_SIZE in
>> > this case?
>>
>> ARRAY_SIZE(x) is defined as (sizeof(x) / sizeof((x)[0])). Works when x
>> is of array type (variable length array is fine). Screws up when x is
>> of *pointer* type.
>>
>> C99 6.5.3.4:
>>
>> The sizeof operator yields the size (in bytes) of its operand, which
>> may be an expression or the parenthesized name of a type. The size
>> is determined from the type of the operand. The result is an
>> integer. If the type of the operand is a variable length array
>> type, the operand is evaluated; otherwise, the operand is not
>> evaluated and the result is an integer constant.
>
> Good to know it. Thanks! :)
>
> However, ARRAY_SIZE() still cannot help solving the unbounded stack
> issue, right?
Measuring the size of the array doesn't change the size of the array :)
- Re: [Qemu-devel] [PATCH 3/8] usb: fix unbounded stack for ohci_td_pkt, (continued)
- [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s, Peter Xu, 2016/03/08
- Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s, Peter Maydell, 2016/03/08
- Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s, Paolo Bonzini, 2016/03/08
- Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s, Peter Xu, 2016/03/09
- Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s, Paolo Bonzini, 2016/03/09
- Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s, Peter Xu, 2016/03/09
- Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s, Markus Armbruster, 2016/03/09
- Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s, Peter Xu, 2016/03/09
- Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s,
Markus Armbruster <=
- Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s, Paolo Bonzini, 2016/03/09
- Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s, Peter Xu, 2016/03/09
[Qemu-devel] [PATCH 5/8] usb: fix unbounded stack for inotify_watchfn, Peter Xu, 2016/03/08
Re: [Qemu-devel] [PATCH 5/8] usb: fix unbounded stack for inotify_watchfn, Paolo Bonzini, 2016/03/08
[Qemu-devel] [PATCH 6/8] usb: fix unbounded stack for usb_mtp_add_str, Peter Xu, 2016/03/08