diff options
-rw-r--r-- | src/soc/amd/picasso/fsp_params.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/soc/amd/picasso/fsp_params.c b/src/soc/amd/picasso/fsp_params.c index 8683e9b836..e7169d1283 100644 --- a/src/soc/amd/picasso/fsp_params.c +++ b/src/soc/amd/picasso/fsp_params.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <assert.h> #include <device/pci.h> #include <soc/pci_devs.h> #include <soc/platform_descriptors.h> @@ -60,6 +61,9 @@ static void fill_dxio_descriptors(FSP_S_CONFIG *scfg, { size_t i; + ASSERT_MSG(num <= FSPS_UPD_DXIO_DESCRIPTOR_COUNT, + "Too many DXIO descriptors provided."); + for (i = 0; i < num; i++) { memcpy(scfg->dxio_descriptor[i], &descs[i], sizeof(scfg->dxio_descriptor[0])); } @@ -70,6 +74,9 @@ static void fill_ddi_descriptors(FSP_S_CONFIG *scfg, { size_t i; + ASSERT_MSG(num <= FSPS_UPD_DDI_DESCRIPTOR_COUNT, + "Too many DDI descriptors provided."); + for (i = 0; i < num; i++) { memcpy(&scfg->ddi_descriptor[i], &descs[i], sizeof(scfg->ddi_descriptor[0])); } |