amlvideo2: reduce vfq size to avoid mem out-of-bounds [1/1]
authorJiacheng Mei <jiacheng.mei@amlogic.com>
Mon, 24 Dec 2018 03:00:08 +0000 (11:00 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 24 Dec 2018 10:00:29 +0000 (02:00 -0800)
PD#SWPL-3355

Problem:
vfq size large than kmalloc mem

Solution:
reduce vfq size to kmalloc mem size

Verify:
T962X-R311

Change-Id: Ibbc0c0219d6f170b4169d76e57419cdeb354f7fe
Signed-off-by: Jiacheng Mei <jiacheng.mei@amlogic.com>
drivers/amlogic/media/video_processor/video_dev/amlvideo2.c

index 05e1c34..452d8ee 100644 (file)
@@ -3593,7 +3593,7 @@ static int amlvideo2_thread_tick(struct amlvideo2_fh *fh)
 
        if ((node->video_blocking) && (node->amlvideo2_pool_ready != NULL)) {
                vfq_init(&node->q_ready,
-               node->amlvideo2_pool_size + 1,
+               node->amlvideo2_pool_size,
                (struct vframe_s **)&(node->amlvideo2_pool_ready[0]));
                node->video_blocking = false;
                node->tmp_vf = NULL;
@@ -5748,7 +5748,7 @@ static int amlvideo2_receiver_event_fun(int type, void *data,
        case VFRAME_EVENT_PROVIDER_REG:
                node->video_blocking = false;
                vfq_init(&node->q_ready,
-               node->amlvideo2_pool_size + 1,
+               node->amlvideo2_pool_size,
                (struct vframe_s **)&(node->amlvideo2_pool_ready[0]));
                break;
        case VFRAME_EVENT_PROVIDER_UNREG:
@@ -5884,7 +5884,7 @@ static int amlvideo2_create_node(struct platform_device *pdev, int node_id)
        }
        if (vid_node->amlvideo2_pool_ready != NULL) {
                vfq_init(&vid_node->q_ready,
-               vid_node->amlvideo2_pool_size + 1,
+               vid_node->amlvideo2_pool_size,
                (struct vframe_s **)&(vid_node->amlvideo2_pool_ready[0]));
        }
        vid_node->context = create_ge2d_work_queue();