kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* variant length array?
@ 2016-04-05 19:29 Wenda Ni
  2016-04-05 19:43 ` Robert P. J. Day
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Wenda Ni @ 2016-04-05 19:29 UTC (permalink / raw)
  To: kernelnewbies

Hi all,

I come across the following code in a kernel module code. It defines an
array whose length is variant at runtime, depending on the actual inputs.
It seems that kernel compiler supports this, which is obvious an error in
the standard ANSI C. Do I have the correct understanding on it?

Thank you.


u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb)
{
         ...
         int hdr_size = sizeof(struct udphdr) +
                 (skb->protocol == htons(ETH_P_IP) ?
                 sizeof(struct iphdr) : sizeof(struct ipv6hdr));
         u8 tmp[hdr_size + RXE_BTH_BYTES];
         ...
}

Cheers,

Wenda Ni, Ph.D.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160405/faf2fc9e/attachment.html 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-04-06 10:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 19:29 variant length array? Wenda Ni
2016-04-05 19:43 ` Robert P. J. Day
2016-04-05 20:00   ` Bjørn Mork
2016-04-05 20:23     ` Rajat Sharma
2016-04-05 21:16     ` Robert P. J. Day
2016-04-05 20:19 ` Valdis.Kletnieks at vt.edu
2016-04-05 20:29   ` Wenda Ni
2016-04-06 10:51 ` Bernd Petrovitsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).