coreboot-kgpe-d16/src/southbridge/amd
Jacob Garber 293e6a96a9 nb/amd/pi,sb/amd/sr5650: Remove unnecessary allocation
add_ivrs_device_entries() is a recursive function, and each recursive
call is passed a pointer to a root_level variable declared outside the
function. In an attempt to make the function self-contained, the initial
call is made with the root_level pointer set to NULL, and then the
function attempts to detect this and allocate a root_level variable for
the rest of the calls. This makes memory management very tricky - for
example, the pi code incorrectly attempts to free the root_level
variable at the end of *each* recursive call, which only avoids being a
double-free because free() in coreboot is currently a no-op. Let's
keep life simple and declare root_level as a local variable outside the
first function call instead.

Change-Id: Ifd63ee368fb89345b9b42ccb86cebcca64f32ac8
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Found-by: Coverity CID 1362811
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34387
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2019-08-20 15:30:47 +00:00
..
agesa AGESA,binaryPI: Replace use of __PRE_RAM__ 2019-08-20 12:47:44 +00:00
amd8111 src: Use include <console/console.h> when appropriate 2019-04-23 10:01:21 +00:00
amd8132 southbridge: Remove unneeded include <pc80/mc146818rtc.h> 2018-12-18 13:56:02 +00:00
cimx AGESA,binaryPI: Replace use of __PRE_RAM__ 2019-08-20 12:47:44 +00:00
common AGESA,binaryPI: Replace use of __PRE_RAM__ 2019-08-20 12:47:44 +00:00
pi AGESA,binaryPI: Replace use of __PRE_RAM__ 2019-08-20 12:47:44 +00:00
rs780 sb/amd/rs780: Remove dead assignment 2019-06-28 19:21:42 +00:00
sb700 src: Make implicit fall throughs explicit 2019-07-19 09:57:54 +00:00
sb800 sb/amd/sb800: Remove bit shift that does nothing 2019-07-19 10:01:50 +00:00
sr5650 nb/amd/pi,sb/amd/sr5650: Remove unnecessary allocation 2019-08-20 15:30:47 +00:00