Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

EDAC/skx_common: Make skx_dev->imc[] a flexible array

The current skx->imc[NUM_IMC] array of memory controller instances is
sized using the macro NUM_IMC. Each time EDAC support is added for a
new CPU, NUM_IMC needs to be updated to ensure it is greater than or
equal to the number of memory controllers for the new CPU. This approach
is inconvenient and results in memory waste for older CPUs with fewer
memory controllers.

To address this, make skx->imc[] a flexible array and determine its size
from configuration data or at runtime.

Suggested-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20250731145534.2759334-5-qiuxu.zhuo@intel.com

authored by

Qiuxu Zhuo and committed by
Tony Luck
43060ca5 30b47b71

+3 -2
+2 -1
drivers/edac/skx_common.c
··· 17 17 #include <linux/acpi.h> 18 18 #include <linux/dmi.h> 19 19 #include <linux/adxl.h> 20 + #include <linux/overflow.h> 20 21 #include <acpi/nfit.h> 21 22 #include <asm/mce.h> 22 23 #include <asm/uv/uv.h> ··· 344 343 if (!pdev) 345 344 break; 346 345 ndev++; 347 - d = kzalloc(sizeof(*d), GFP_KERNEL); 346 + d = kzalloc(struct_size(d, imc, imc_num), GFP_KERNEL); 348 347 if (!d) { 349 348 pci_dev_put(pdev); 350 349 return -ENOMEM;
+1 -1
drivers/edac/skx_common.h
··· 172 172 u8 colbits; 173 173 } dimms[NUM_DIMMS]; 174 174 } chan[NUM_CHANNELS]; 175 - } imc[NUM_IMC]; 175 + } imc[]; 176 176 }; 177 177 178 178 struct skx_pvt {