[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: |
Peter Xu |
Subject: |
Re: [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s |
Date: |
Wed, 9 Mar 2016 17:19:12 +0800 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
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?
Peter
- 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 <=
- 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, 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