Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32713
Change subject: util/inteltool: Error if first channel is not found ......................................................................
util/inteltool: Error if first channel is not found
The first channel is needed to initialize the timing arrays. If it is not present there will be undefined reads in the 'print_time' function calls starting on line 182.
Found-by: Coverity Scan #1370{584,585,588,589,590-596,600} Signed-off-by: Jacob Garber jgarber1@ualberta.ca Change-Id: I6b59989242e498474782876302e0850e3e4cf2d3 --- M util/inteltool/ivy_memory.c 1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/32713/1
diff --git a/util/inteltool/ivy_memory.c b/util/inteltool/ivy_memory.c index 8ce8611..c079071 100644 --- a/util/inteltool/ivy_memory.c +++ b/util/inteltool/ivy_memory.c @@ -97,7 +97,13 @@ rankmap[channel] = read_mchbar32(0xc14 + 0x100 * channel) >> 24; }
- two_channels = rankmap[0] && rankmap[1]; + // The second channel is optional, but the first channel is not + if (rankmap[0] == 0) { + fputs("Error: first channel not found\n", stderr); + exit(1); + } + + two_channels = rankmap[1];
mr0[0] = read_mchbar32(0x0004); mr1[0] = read_mchbar32(0x0008);