mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
arch/x86/smbios: fix length calculation for SMBIOS type 17
Different DIMM modules give different SMBIOS type 17 lengths, so we can't use `meminfo->dimm_cnt*len' for entry struct size, otherwise it'll give a wrong SMBIOS size when two or more different DIMMs are installed on the machine. Change-Id: I0e33853f6aa4b30da547eb433839a397d451a8cf Signed-off-by: Iru Cai <mytbk920423@gmail.com> Reviewed-on: https://review.coreboot.org/14008 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
f2e0461d89
commit
3677520fd9
1 changed files with 3 additions and 1 deletions
|
@ -473,6 +473,7 @@ static int smbios_write_type11(unsigned long *current, int *handle)
|
||||||
static int smbios_write_type17(unsigned long *current, int *handle)
|
static int smbios_write_type17(unsigned long *current, int *handle)
|
||||||
{
|
{
|
||||||
int len = sizeof(struct smbios_type17);
|
int len = sizeof(struct smbios_type17);
|
||||||
|
int totallen = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
struct memory_info *meminfo;
|
struct memory_info *meminfo;
|
||||||
|
@ -486,8 +487,9 @@ static int smbios_write_type17(unsigned long *current, int *handle)
|
||||||
dimm = &meminfo->dimm[i];
|
dimm = &meminfo->dimm[i];
|
||||||
len = create_smbios_type17_for_dimm(dimm, current, handle);
|
len = create_smbios_type17_for_dimm(dimm, current, handle);
|
||||||
*current += len;
|
*current += len;
|
||||||
|
totallen += len;
|
||||||
}
|
}
|
||||||
return meminfo->dimm_cnt * len;
|
return totallen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smbios_write_type32(unsigned long *current, int handle)
|
static int smbios_write_type32(unsigned long *current, int handle)
|
||||||
|
|
Loading…
Add table
Reference in a new issue