aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/smbios.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/i386/smbios.c')
-rw-r--r--hw/i386/smbios.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c
index 024e59445b..ae7032adda 100644
--- a/hw/i386/smbios.c
+++ b/hw/i386/smbios.c
@@ -850,7 +850,8 @@ void smbios_get_tables(uint8_t **tables, size_t *tables_len,
}
#define MAX_DIMM_SZ (16ll * ONE_GB)
-#define GET_DIMM_SZ ((i < dimm_cnt - 1) ? MAX_DIMM_SZ : ram_size % MAX_DIMM_SZ)
+#define GET_DIMM_SZ ((i < dimm_cnt - 1) ? MAX_DIMM_SZ \
+ : ((ram_size - 1) % MAX_DIMM_SZ) + 1)
dimm_cnt = QEMU_ALIGN_UP(ram_size, MAX_DIMM_SZ) / MAX_DIMM_SZ;