Fix: gcc-9.1 stack frame size warning
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 6 Sep 2019 01:01:47 +0000 (21:01 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 6 Sep 2019 16:15:41 +0000 (12:15 -0400)
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 <mathieu.desnoyers@efficios.com>
lttng-abi.c

index bee4255d47b4832d15dc2b48d2bc1514b7b41568..1f00a0e5427aca5111bd625bc9193992269d406c 100644 (file)
@@ -490,13 +490,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)))
@@ -513,8 +512,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)))
@@ -534,9 +531,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)))
@@ -553,8 +547,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)))
This page took 0.027592 seconds and 4 git commands to generate.