Skip to content

Commit 7d73d57

Browse files
committed
MIPS: math-emu: Reuse name array in debugfs_fpuemu()
The FPU_STAT_CREATE_EX() macro used 114 times in debugfs_fpuemu() declares a 32 byte char array to hold the name of a debugfs file. Since each use of the macro declares a new char array out of the scope of all the other uses, we end up with an unnecessarily large stack frame of 3648 bytes (ie. 114*32) plus the size of 2 pointers (fpuemu_debugfs_base_dir & fpuemu_debugfs_inst_dir). This is enough to trigger the frame size warnings from GCC in common configurations. Avoid the unnecessary stack bloat by using a single name char array which each usage of FPU_STAT_CREATE_EX() will reinitialize via the strcpy() in adjust_instruction_counter_name(). Signed-off-by: Paul Burton <[email protected]> Reported-by: kbuild test robot <[email protected]> URL: https://lore.kernel.org/linux-mips/201911090929.xvXYuHUz%[email protected]/
1 parent dcf78ee commit 7d73d57

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/mips/math-emu/me-debugfs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ static int __init debugfs_fpuemu(void)
189189
{
190190
struct dentry *fpuemu_debugfs_base_dir;
191191
struct dentry *fpuemu_debugfs_inst_dir;
192+
char name[32];
192193

193194
fpuemu_debugfs_base_dir = debugfs_create_dir("fpuemustats",
194195
mips_debugfs_dir);
@@ -225,8 +226,6 @@ do { \
225226

226227
#define FPU_STAT_CREATE_EX(m) \
227228
do { \
228-
char name[32]; \
229-
\
230229
adjust_instruction_counter_name(name, #m); \
231230
\
232231
debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir, \

0 commit comments

Comments
 (0)