Skip to content

Commit 5b24ac2

Browse files
committed
kcsan: test: don't put the expect array on the stack
Size of the 'expect' array in the __report_matches is 1536 bytes, which is exactly the default frame size warning limit of the xtensa architecture. As a result allmodconfig xtensa kernel builds with the gcc that does not support the compiler plugins (which otherwise would push the said warning limit to 2K) fail with the following message: kernel/kcsan/kcsan_test.c:257:1: error: the frame size of 1680 bytes is larger than 1536 bytes Fix it by dynamically allocating the 'expect' array. Signed-off-by: Max Filippov <[email protected]> Reviewed-by: Marco Elver <[email protected]> Tested-by: Marco Elver <[email protected]>
1 parent 88603b6 commit 5b24ac2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

kernel/kcsan/kcsan_test.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static bool __report_matches(const struct expect_report *r)
159159
const bool is_assert = (r->access[0].type | r->access[1].type) & KCSAN_ACCESS_ASSERT;
160160
bool ret = false;
161161
unsigned long flags;
162-
typeof(observed.lines) expect;
162+
typeof(*observed.lines) *expect;
163163
const char *end;
164164
char *cur;
165165
int i;
@@ -168,6 +168,10 @@ static bool __report_matches(const struct expect_report *r)
168168
if (!report_available())
169169
return false;
170170

171+
expect = kmalloc(sizeof(observed.lines), GFP_KERNEL);
172+
if (WARN_ON(!expect))
173+
return false;
174+
171175
/* Generate expected report contents. */
172176

173177
/* Title */
@@ -253,6 +257,7 @@ static bool __report_matches(const struct expect_report *r)
253257
strstr(observed.lines[2], expect[1])));
254258
out:
255259
spin_unlock_irqrestore(&observed.lock, flags);
260+
kfree(expect);
256261
return ret;
257262
}
258263

0 commit comments

Comments
 (0)