Thread (3 messages) 3 messages, 3 authors, 2023-01-04

Re: [PATCH] fbdev: omapfb: avoid stack overflow warning

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2022-12-16 13:06:36
Also in: dri-devel, linux-omap, lkml

Hi Arnd,

On Thu, Dec 15, 2022 at 6:05 PM Arnd Bergmann [off-list ref] wrote:
From: Arnd Bergmann <arnd@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@arndb.de>
Thanks for your patch!
quoted hunk ↗ jump to hunk
--- 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@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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help