summaryrefslogtreecommitdiffstats
path: root/src/soc/intel/common/smbios.c
diff options
context:
space:
mode:
authorBarnali Sarkar <barnali.sarkar@intel.com>2017-03-07 17:11:03 +0530
committerAaron Durbin <adurbin@chromium.org>2017-03-10 19:59:58 +0100
commit6497cd9744394782a18da28bf6228143f8f32de7 (patch)
tree31581ff4bdc5dd66fe785d9553988fe4b4340da9 /src/soc/intel/common/smbios.c
parent674c089922332a600ac69c596a174c3ad2bce5c4 (diff)
downloadcoreboot-6497cd9744394782a18da28bf6228143f8f32de7.tar.gz
coreboot-6497cd9744394782a18da28bf6228143f8f32de7.tar.bz2
coreboot-6497cd9744394782a18da28bf6228143f8f32de7.zip
soc/intel/common: Pass the minimum possible string length for strncpy
In strncpy() function of dimm_info_fill(), the minimum possible size of Module Part Number of DIMM is passed as argument. BUG=chrome-os-partner:61729 BRANCH=none TEST=Build and boot KBLRVP to verify the type 17 DIMM info coming in SMBIOS Table from Kernel command "dmidecode". Change-Id: Icc7667149eae9705b91e271628af1b443eb8556e Signed-off-by: Barnali Sarkar <barnali.sarkar@intel.com> Reviewed-on: https://review.coreboot.org/18617 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc/intel/common/smbios.c')
-rw-r--r--src/soc/intel/common/smbios.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/soc/intel/common/smbios.c b/src/soc/intel/common/smbios.c
index 3aee9ff42403..6c14ff0b6773 100644
--- a/src/soc/intel/common/smbios.c
+++ b/src/soc/intel/common/smbios.c
@@ -20,7 +20,8 @@
/* Fill the SMBIOS memory information from FSP MEM_INFO_DATA_HOB in CBMEM.*/
void dimm_info_fill(struct dimm_info *dimm, u32 dimm_capacity, u8 ddr_type,
- u32 frequency, u8 channel_id, u8 dimm_id, const char *module_part_num,
+ u32 frequency, u8 channel_id, u8 dimm_id,
+ const char *module_part_num, size_t module_part_number_size,
u16 data_width)
{
dimm->dimm_size = dimm_capacity;
@@ -30,7 +31,8 @@ void dimm_info_fill(struct dimm_info *dimm, u32 dimm_capacity, u8 ddr_type,
dimm->dimm_num = dimm_id;
strncpy((char *)dimm->module_part_number,
module_part_num,
- sizeof(dimm->module_part_number));
+ min(sizeof(dimm->module_part_number),
+ module_part_number_size));
switch (data_width) {
case 8:
dimm->bus_width = MEMORY_BUS_WIDTH_8;