coreboot-kgpe-d16/src/southbridge/intel/common
Jacob Garber 9172b6920c src: Remove variable length arrays
Variable length arrays were a feature added in C99 that allows the
length of an array to be determined at runtime. Eg.

	int sum(size_t n) {
		int arr[n];
		...
	}

This adds a small amount of runtime overhead, but is also very
dangerous, since it allows use of an unlimited amount of stack memory,
potentially leading to stack overflow. This is only worsened in
coreboot, which often has very little stack space to begin with. Citing
concerns like this, all instances of VLA's were recently removed from the
Linux kernel. In the immortal words of Linus Torvalds [0],

    AND 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. [...] Anyway, some of these are definitely
    easy to just fix, and using VLA's is actively bad not just for
    security worries, but simply because VLA's are a really horribly bad
    idea in general in the kernel.

This patch follows suit and zaps all VLA's in coreboot. Some of the
existing VLA's are accidental ones, and all but one can be replaced with
small fixed-size buffers. The single tricky exception is in the SPI
controller interface, which will require a rewrite of old drivers
to remove [1].

[0] https://lkml.org/lkml/2018/3/7/621
[1] https://ticket.coreboot.org/issues/217

Change-Id: I7d9d1ddadbf1cee5f695165bbe3f0effb7bd32b9
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33821
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2019-08-20 15:27:42 +00:00
..
acpi sb/intel/bd82x6x: Move pcie ACPI code to a common place 2019-01-03 22:32:50 +00:00
firmware nb/intel/snb: Drop NORTHBRIDGE_INTEL_IVYBRIDGE 2019-05-12 15:03:03 +00:00
acpi_pirq_gen.c arch/io.h: Drop unnecessary include 2019-03-04 15:08:03 +00:00
acpi_pirq_gen.h sb/intel/common/pirq_gen: Rework generating pin-route tables 2018-05-25 20:32:58 +00:00
finalize.c coreboot: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-08 08:33:24 +00:00
finalize.h sb/intel/common: Create a common PCH finalise implementation 2018-12-03 13:14:06 +00:00
gpio.c src: Use 'include <string.h>' when appropriate 2019-03-20 20:27:51 +00:00
gpio.h Move compiler.h to commonlib 2018-10-08 16:57:27 +00:00
Kconfig sb/{ICH7,NM10,PCH}: Use common watchdog_off function 2019-05-07 16:01:35 +00:00
madt.c sb/intel/common: Create a common implementation of acpi_fill_madt() 2018-11-01 22:26:04 +00:00
Makefile.inc sb/intel/common: Link SPI code in bootblock 2019-06-21 09:18:57 +00:00
pciehp.c src: Drop unused 'include <device/pciexp.h>' 2019-03-16 11:46:38 +00:00
pciehp.h sb/intel/common/pciehp.h: Add missing license header 2018-11-01 11:26:33 +00:00
pmbase.c device/pci: Fix PCI accessor headers 2019-03-01 20:32:15 +00:00
pmbase.h sb/intel/common: Add functions to manipulate PMBASE 2018-07-27 16:19:28 +00:00
pmclib.c sb/intel/common: Add common detect_s3_resume 2019-04-13 14:48:25 +00:00
pmclib.h sb/intel/common: Fix config name in a comment 2019-04-13 15:38:01 +00:00
pmutil.c arch/io.h: Drop unnecessary include 2019-03-04 15:08:03 +00:00
pmutil.h cpu/x86: Separate save_state struct headers 2019-08-13 13:59:05 +00:00
rcba.h mb/lenovo/[xtz]60: Introduce and use RCBA64 macro 2019-01-14 11:57:25 +00:00
rcba_pirq.c sb/intel/common/rcba_pirq.c: Use common RCBA acces MACROs 2018-06-21 15:51:38 +00:00
rcba_pirq.h sb/intel/common/rcba_pirq.c: Use common RCBA acces MACROs 2018-06-21 15:51:38 +00:00
reset.c intel: Use CF9 reset (part 1) 2018-10-22 08:35:25 +00:00
rtc.c coreboot: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-08 08:33:24 +00:00
rtc.h sb/intel: Deduplicate vbnv_cmos_failed and rtc_init 2018-11-07 18:12:39 +00:00
smbus.c southbridge/intel/common/smbus: Add do_i2c_block_write() 2019-06-20 15:25:51 +00:00
smbus.h southbridge/intel/common/smbus: Add do_i2c_block_write() 2019-06-20 15:25:51 +00:00
smi.c soc/intel: Rename some SMM support functions 2019-08-15 06:55:59 +00:00
smihandler.c cpu/x86: Change old-style SMI handler prototypes 2019-08-13 14:00:06 +00:00
spi.c src: Remove variable length arrays 2019-08-20 15:27:42 +00:00
spi.h sb/intel/common: Add a common interface to set final OPs settings 2019-07-08 14:52:54 +00:00
tco.h sb/{ICH7,NM10,PCH}: Use common watchdog_off function 2019-05-07 16:01:35 +00:00
usb_debug.c coreboot: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-08 08:33:24 +00:00
watchdog.c sb/{ICH7,NM10,PCH}: Use common watchdog_off function 2019-05-07 16:01:35 +00:00