amlogic: media_modules: fix too big stack usage for gcc 9 build
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 12 Mar 2020 10:01:18 +0000 (19:01 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 2 Dec 2020 01:56:37 +0000 (10:56 +0900)
Too big stack usage causes build issue for gcc 9. Fix too big stack
usage by replacing kzalloc() instead of array in stack.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/amlogic/media_modules/frame_provider/decoder/utils/frame_check.c

index 95d2609..7118bd1 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/delay.h>
 #include <linux/timer.h>
 #include <linux/kfifo.h>
+#include <linux/slab.h>
 #include <linux/kthread.h>
 #include <linux/platform_device.h>
 #include <linux/amlogic/media/canvas/canvas.h>
@@ -316,11 +317,12 @@ static int write_yuv_work(struct pic_check_mgr_t *mgr)
 static int write_crc_work(struct pic_check_mgr_t *mgr)
 {
        unsigned int wr_size;
-       char *crc_buf, crc_tmp[64*30];
+       char *crc_buf, *crc_tmp;
        mm_segment_t old_fs;
        struct pic_check_t *check = &mgr->pic_check;
 
        if (mgr->enable & CRC_MASK) {
+               crc_tmp = kzalloc(64 * 30 * sizeof(char), GFP_KERNEL);
                wr_size = 0;
                while (kfifo_get(&check->wr_chk_q, &crc_buf) != 0) {
                        wr_size += sprintf(&crc_tmp[wr_size], "%s", crc_buf);
@@ -342,6 +344,7 @@ static int write_crc_work(struct pic_check_mgr_t *mgr)
                        }
                        set_fs(old_fs);
                }
+               kfree(crc_tmp);
        }
        return 0;
 }