[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aJO-ApXFIs27couW@smile.fi.intel.com>
Date: Wed, 6 Aug 2025 23:41:38 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Abinash Singh <abinashsinghlalotra@...il.com>
Cc: arnd@...db.de, gregkh@...uxfoundation.org, jirislaby@...nel.org,
linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
sunilvl@...tanamicro.com, u.kleine-koenig@...libre.com
Subject: Re: [PATCH v2 1/2] serial: 8250_platform: Reduce stack usage in
serial8250_probe_acpi()
On Thu, Aug 07, 2025 at 01:40:46AM +0530, Abinash Singh wrote:
> The function serial8250_probe_acpi() in 8250_platform.c triggered a
> frame size warning:
> drivers/tty/serial/8250/8250_platform.c: In function ‘serial8250_probe_acpi’:
> drivers/tty/serial/8250/8250_platform.c:152:1: warning: the frame size of 1160 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>
> This patch reduces the stack usage by dynamically allocating the
> `uart` structure using kzalloc(), rather than placing it on
> the stack. This eliminates the overflow warning and improves kernel
> robustness.
...
> struct resource *regs;
> int ret, line;
> + struct uart_8250_port *uart __free(kfree) = kzalloc(sizeof(*uart), GFP_KERNEL);
> +
> + if (!uart)
> + return -ENOMEM;
For cleanup (__free() in particular) we allow to mix definitions with the code
and it would be natural to have it a bit different
struct resource *regs;
int ret, line;
struct uart_8250_port *uart __free(kfree) = kzalloc(sizeof(*uart), GFP_KERNEL);
if (!uart)
return -ENOMEM;
(In your case just a blank line placement is one line above.)
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists