Re: [PATCH] can: Replace zero-length array with flexible-array

From: Oliver Hartkopp
Date: Thu Jun 04 2020 - 02:38:07 EST


Hi Gustavo,

On 04.06.20 02:58, Gustavo A. R. Silva wrote:

Sorry for the late reply. I totally lost track of this thread. :/

NP. At least your workflow seems to work :o)

pahole shows exactly the same output either if cf is a zero-length array or
a flexible-array member:

$ pahole -C 'can_skb_priv' drivers/net/can/dev.o

struct can_skb_priv {
int ifindex; /* 0 4 */
int skbcnt; /* 4 4 */
struct can_frame cf[] __attribute__((__aligned__(8))); /* 8 0 */

/* size: 8, cachelines: 1, members: 3 */
/* forced alignments: 1 */
/* last cacheline: 8 bytes */
} __attribute__((__aligned__(8)));

So, it seems everything should fine. :)

Great! Thanks for the info - and how I could have checked it on my own, too.

Best,
Oliver