[Top][All Lists]

[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
>     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?


reply via email to

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