✘Kill all VLAs

Gary E. Miller gem at rellim.com
Mon Oct 29 19:02:42 UTC 2018


Yo All!

The Linux kernel has now removed all Varible Length Arrays (VLAs).

Linux has spoke:

"USING VLA'S IS ACTIVELY STUPID! It generates much more code, and much
_slower_ code (and more fragile code), than just using a fixed key size
would have done."

It is easy to find where VLAs are used, just add the -Wvla cflag.

# export CGLAG=-Wvla

Then build as usual.

Looks like git head NTPsec has two VLAs:

[180/273] Compiling tests/libntp/ymd2yd.c
../../tests/libntp/macencrypt.c: In function 'TEST_macencrypt_Encrypt_':
../../tests/libntp/macencrypt.c:34:2: warning: ISO C90 forbids array 'packetPtr'
 whose size can't be evaluated [-Wvla]
  char packetPtr[totalLength];
  ^~~~
../../tests/libntp/macencrypt.c: In function 'TEST_macencrypt_CMAC_Encrypt_':
../../tests/libntp/macencrypt.c:70:2: warning: ISO C90 forbids array 'packetPtr' whose size can't be evaluated [-Wvla]
  char packetPtr[totalLength];
  ^~~~

Should be easy to fix.  Anyone want to try?


RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 851 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20181029/5fe0d426/attachment.bin>


More information about the devel mailing list