summaryrefslogtreecommitdiffstats
path: root/util/spd_tools
diff options
context:
space:
mode:
authorReka Norman <rekanorman@google.com>2021-09-16 10:12:31 +1000
committerFurquan Shaikh <furquan@google.com>2021-09-21 17:21:23 +0000
commit780b04e639976eabc784ac40f802ee0fc9275056 (patch)
treecd37c276dd26dc076d362112bb6996fed5135584 /util/spd_tools
parentc9686d22b173ce10951097021c1a14f03ab9bb8a (diff)
downloadcoreboot-780b04e639976eabc784ac40f802ee0fc9275056.tar.gz
coreboot-780b04e639976eabc784ac40f802ee0fc9275056.tar.bz2
coreboot-780b04e639976eabc784ac40f802ee0fc9275056.zip
util/spd_tools: Add max ID check for auto-generated IDs to part_id_gen
Currently, the maximum part ID of 15 is enforced only for manually assigned IDs. Also enforce it for automatically assigned IDs. BUG=b:191776301 TEST=part_id_gen fails when the number of part IDs which would be assigned is greater than MaxMemoryId. Signed-off-by: Reka Norman <rekanorman@google.com> Change-Id: I802190a13b68439ccbcdb28300ccc5fd1b38a9c9 Reviewed-on: https://review.coreboot.org/c/coreboot/+/57691 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Diffstat (limited to 'util/spd_tools')
-rw-r--r--util/spd_tools/src/part_id_gen/part_id_gen.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/spd_tools/src/part_id_gen/part_id_gen.go b/util/spd_tools/src/part_id_gen/part_id_gen.go
index 3db2b6e8d933..7803361e48a8 100644
--- a/util/spd_tools/src/part_id_gen/part_id_gen.go
+++ b/util/spd_tools/src/part_id_gen/part_id_gen.go
@@ -240,6 +240,9 @@ func genPartIdInfo(parts []usedPart, partToSPDMap map[string]string, SPDToIndexM
// Append new entry
if index == -1 {
index = len(partIdList)
+ if index > MaxMemoryId {
+ return nil, fmt.Errorf("Maximum part ID %d exceeded.", MaxMemoryId)
+ }
partIdList = append(partIdList, partIds{})
}