Skip to content

Commit 0ea923f

Browse files
arndbmiquelraynal
authored andcommitted
mtdchar: mark bits of ioctl handler noinline
The addition of the mtdchar_read_ioctl() function caused the stack usage of mtdchar_ioctl() to grow beyond the warning limit on 32-bit architectures with gcc-13: drivers/mtd/mtdchar.c: In function 'mtdchar_ioctl': drivers/mtd/mtdchar.c:1229:1: error: the frame size of 1488 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] Mark both the read and write portions as noinline_for_stack to ensure they don't get inlined and use separate stack slots to reduce the maximum usage, both in the mtdchar_ioctl() and combined with any of its callees. Fixes: 095bb6e ("mtdchar: add MEMREAD ioctl") Cc: [email protected] Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Richard Weinberger <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 444c17c commit 0ea923f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/mtd/mtdchar.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,8 @@ static void adjust_oob_length(struct mtd_info *mtd, uint64_t start,
590590
(end_page - start_page + 1) * oob_per_page);
591591
}
592592

593-
static int mtdchar_write_ioctl(struct mtd_info *mtd,
594-
struct mtd_write_req __user *argp)
593+
static noinline_for_stack int
594+
mtdchar_write_ioctl(struct mtd_info *mtd, struct mtd_write_req __user *argp)
595595
{
596596
struct mtd_info *master = mtd_get_master(mtd);
597597
struct mtd_write_req req;
@@ -688,8 +688,8 @@ static int mtdchar_write_ioctl(struct mtd_info *mtd,
688688
return ret;
689689
}
690690

691-
static int mtdchar_read_ioctl(struct mtd_info *mtd,
692-
struct mtd_read_req __user *argp)
691+
static noinline_for_stack int
692+
mtdchar_read_ioctl(struct mtd_info *mtd, struct mtd_read_req __user *argp)
693693
{
694694
struct mtd_info *master = mtd_get_master(mtd);
695695
struct mtd_read_req req;

0 commit comments

Comments
 (0)