From: Mathieu Desnoyers Date: Fri, 6 Sep 2019 01:01:47 +0000 (-0400) Subject: Fix: gcc-9.1 stack frame size warning X-Git-Tag: v2.12.0-pre~30 X-Git-Url: http://git.liburcu.org/?p=lttng-modules.git;a=commitdiff_plain;h=2d4c4d15a0483c8463874522503da3b2f840e9f6 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 --- 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)))