Skip to content

Commit e82b3a6

Browse files
arndbKent Overstreet
authored andcommitted
bcachefs: ioctl: avoid stack overflow warning
Multiple ioctl handlers individually use a lot of stack space, and clang chooses to inline them into the bch2_fs_ioctl() function, blowing through the warning limit: fs/bcachefs/chardev.c:655:6: error: stack frame size (1032) exceeds limit (1024) in 'bch2_fs_ioctl' [-Werror,-Wframe-larger-than] 655 | long bch2_fs_ioctl(struct bch_fs *c, unsigned cmd, void __user *arg) By marking the largest two of them as noinline_for_stack, no indidual code path ends up using this much, which avoids the warning and reduces the possible total stack usage in the ioctl handler. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
1 parent c3dd253 commit e82b3a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/bcachefs/chardev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ static long bch2_ioctl_data(struct bch_fs *c,
399399
return ret;
400400
}
401401

402-
static long bch2_ioctl_fs_usage(struct bch_fs *c,
402+
static noinline_for_stack long bch2_ioctl_fs_usage(struct bch_fs *c,
403403
struct bch_ioctl_fs_usage __user *user_arg)
404404
{
405405
struct bch_ioctl_fs_usage arg = {};
@@ -469,7 +469,7 @@ static long bch2_ioctl_query_accounting(struct bch_fs *c,
469469
}
470470

471471
/* obsolete, didn't allow for new data types: */
472-
static long bch2_ioctl_dev_usage(struct bch_fs *c,
472+
static noinline_for_stack long bch2_ioctl_dev_usage(struct bch_fs *c,
473473
struct bch_ioctl_dev_usage __user *user_arg)
474474
{
475475
struct bch_ioctl_dev_usage arg;

0 commit comments

Comments
 (0)