[PATCH] EDAC, sb_edac: Remove VLA usage
From: Gustavo A. R. Silva
Date: Fri Mar 09 2018 - 22:50:49 EST
In preparation to enabling -Wvla, remove VLA and replace it
with a fixed-length array instead.
Fixed as part of the directive to remove all VLAs from
the kernel: https://lkml.org/lkml/2018/3/7/621
Signed-off-by: Gustavo A. R. Silva <garsilva@xxxxxxxxxxxxxx>
---
Notice that due to this change, the field max_interleave is no longer
used after it has been initialized. Maybe it should be removed?
Thanks
--
Gustavo
---
drivers/edac/sb_edac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 8721002..11cb2c9 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -110,6 +110,7 @@ static const u32 knl_interleave_list[] = {
0xdc, 0xe4, 0xec, 0xf4, 0xfc, /* 15-19 */
0x104, 0x10c, 0x114, 0x11c, /* 20-23 */
};
+#define MAX_INTERLEAVE ARRAY_SIZE(knl_interleave_list)
struct interleave_pkg {
unsigned char start;
@@ -1899,7 +1900,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
int n_rir, n_sads, n_tads, sad_way, sck_xch;
int sad_interl, idx, base_ch;
int interleave_mode, shiftup = 0;
- unsigned sad_interleave[pvt->info.max_interleave];
+ unsigned int sad_interleave[MAX_INTERLEAVE];
u32 reg, dram_rule;
u8 ch_way, sck_way, pkg, sad_ha = 0;
u32 tad_offset;
--
2.7.4