Anastasia Klimchuk submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Anastasia Klimchuk: Looks good to me, approved
ich_descriptors: Fix debug print

Allow nm, the number of flash masters, to be equal to
ARRAY_SIZE(master_names). The previous logic was probably overlooked
when ich_number_of_masters() was introduced. The loop below makes sure
that it doesn't access the master_names array out of bounds.

Change-Id: Ib9276a6c29952487db6e60fb583942c0f24cd6ef
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/78300
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
---
M ich_descriptors.c
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ich_descriptors.c b/ich_descriptors.c
index a2a99bd..4b440ed 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -493,9 +493,9 @@
const char *const master_names[] = {
"BIOS", "ME", "GbE", "unknown", "EC",
};
- if (nm >= (ssize_t)ARRAY_SIZE(master_names)) {
- msg_pdbg2("%s: number of masters too high (%d).\n", __func__,
- desc->content.NM + 1);
+
+ if (nm > (ssize_t)ARRAY_SIZE(master_names)) {
+ msg_pdbg2("%s: number of masters too high (%zd).\n", __func__, nm);
return;
}


To view, visit change 78300. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Ib9276a6c29952487db6e60fb583942c0f24cd6ef
Gerrit-Change-Number: 78300
Gerrit-PatchSet: 4
Gerrit-Owner: Patrick Rudolph <rudolphpatrick05@gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged