mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
kcsan: test: don't put the expect array on the stack
[ Upstream commit 5b24ac2dfd
]
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 <jcmvbkbc@gmail.com>
Reviewed-by: Marco Elver <elver@google.com>
Tested-by: Marco Elver <elver@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c51c0b3754
commit
f0e6dcae14
@ -151,7 +151,7 @@ static bool report_matches(const struct expect_report *r)
|
||||
const bool is_assert = (r->access[0].type | r->access[1].type) & KCSAN_ACCESS_ASSERT;
|
||||
bool ret = false;
|
||||
unsigned long flags;
|
||||
typeof(observed.lines) expect;
|
||||
typeof(*observed.lines) *expect;
|
||||
const char *end;
|
||||
char *cur;
|
||||
int i;
|
||||
@ -160,6 +160,10 @@ static bool report_matches(const struct expect_report *r)
|
||||
if (!report_available())
|
||||
return false;
|
||||
|
||||
expect = kmalloc(sizeof(observed.lines), GFP_KERNEL);
|
||||
if (WARN_ON(!expect))
|
||||
return false;
|
||||
|
||||
/* Generate expected report contents. */
|
||||
|
||||
/* Title */
|
||||
@ -243,6 +247,7 @@ static bool report_matches(const struct expect_report *r)
|
||||
strstr(observed.lines[2], expect[1])));
|
||||
out:
|
||||
spin_unlock_irqrestore(&observed.lock, flags);
|
||||
kfree(expect);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user