From 2d4c4d15a0483c8463874522503da3b2f840e9f6 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 5 Sep 2019 21:01:47 -0400 Subject: [PATCH] Fix: gcc-9.1 stack frame size warning gcc-9.1.0 warns about lttng_session_ioctl taking a too large frame size. lttng-modules/lttng-abi.c:622:1: warning: the frame size of 2240 bytes is larger than 2048 bytes [-Wframe-larger-than=] Combine the variables used in the various case of the switch so they are not duplicated on the stack by the compiler. Signed-off-by: Mathieu Desnoyers --- lttng-abi.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lttng-abi.c b/lttng-abi.c index cc8f1838..5624b6c4 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -514,13 +514,12 @@ static long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct lttng_session *session = file->private_data; + struct lttng_kernel_channel chan_param; + struct lttng_kernel_old_channel old_chan_param; switch (cmd) { case LTTNG_KERNEL_OLD_CHANNEL: { - struct lttng_kernel_channel chan_param; - struct lttng_kernel_old_channel old_chan_param; - if (copy_from_user(&old_chan_param, (struct lttng_kernel_old_channel __user *) arg, sizeof(struct lttng_kernel_old_channel))) @@ -537,8 +536,6 @@ long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } case LTTNG_KERNEL_CHANNEL: { - struct lttng_kernel_channel chan_param; - if (copy_from_user(&chan_param, (struct lttng_kernel_channel __user *) arg, sizeof(struct lttng_kernel_channel))) @@ -558,9 +555,6 @@ long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return lttng_session_disable(session); case LTTNG_KERNEL_OLD_METADATA: { - struct lttng_kernel_channel chan_param; - struct lttng_kernel_old_channel old_chan_param; - if (copy_from_user(&old_chan_param, (struct lttng_kernel_old_channel __user *) arg, sizeof(struct lttng_kernel_old_channel))) @@ -577,8 +571,6 @@ long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } case LTTNG_KERNEL_METADATA: { - struct lttng_kernel_channel chan_param; - if (copy_from_user(&chan_param, (struct lttng_kernel_channel __user *) arg, sizeof(struct lttng_kernel_channel))) -- 2.34.1