diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2023-10-12 14:22:01 +0200 |
---|---|---|
committer | Anastasia Klimchuk <aklm@chromium.org> | 2023-10-25 10:01:29 +0000 |
commit | 0b8dcba50cfc425d40500fa55439f679b5f10844 (patch) | |
tree | c32321743d7a3ba197746ba83933a58c5c97fa2d | |
parent | fba29da188b4a3aa8a3cf6f5a3d13c37a5d9e1d7 (diff) | |
download | flashrom-0b8dcba50cfc425d40500fa55439f679b5f10844.tar.gz flashrom-0b8dcba50cfc425d40500fa55439f679b5f10844.tar.bz2 flashrom-0b8dcba50cfc425d40500fa55439f679b5f10844.zip |
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>
-rw-r--r-- | ich_descriptors.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ich_descriptors.c b/ich_descriptors.c index a2a99bd0b..4b440ed7b 100644 --- a/ich_descriptors.c +++ b/ich_descriptors.c @@ -493,9 +493,9 @@ void prettyprint_ich_descriptor_master(const enum ich_chipset cs, const struct i 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; } |