[PATCH] fbdev: omapfb: avoid stack overflow warning

Geert Uytterhoeven geert at linux-m68k.org
Fri Dec 16 13:05:46 UTC 2022


Hi Arnd,

On Thu, Dec 15, 2022 at 6:05 PM Arnd Bergmann <arnd at kernel.org> wrote:
> From: Arnd Bergmann <arnd at arndb.de>
>
> The dsi_irq_stats structure is a little too big to fit on the
> stack of a 32-bit task, depending on the specific gcc options:
>
> fbdev/omap2/omapfb/dss/dsi.c: In function 'dsi_dump_dsidev_irqs':
> fbdev/omap2/omapfb/dss/dsi.c:1621:1: error: the frame size of 1064 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>
> Since this is only a debugfs file, performance is not critical,
> so just dynamically allocate it, and print an error message
> in there in place of a failure code when the allocation fails.
>
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>

Thanks for your patch!

> --- a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
> +++ b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
> @@ -1536,22 +1536,28 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
>  {
>         struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
>         unsigned long flags;
> -       struct dsi_irq_stats stats;
> +       struct dsi_irq_stats *stats;
> +
> +       stats = kzalloc(sizeof(*stats), GFP_KERNEL);
> +       if (!stats) {
> +               seq_printf(s, "out of memory\n");

I guess this is futile?
No need to increase kernel size for OOM messages.

> +               return;
> +       }
>
>         spin_lock_irqsave(&dsi->irq_stats_lock, flags);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


More information about the dri-devel mailing list