v4l2: fix a kernel warning for vp9 decoder [1/1]
authorSong Zhao <song.zhao@amlogic.com>
Fri, 12 Jun 2020 06:08:09 +0000 (23:08 -0700)
committerSong Zhao <song.zhao@amlogic.com>
Mon, 15 Jun 2020 23:20:03 +0000 (16:20 -0700)
PD#SWPL-27786

Problem:
vzalloc is called with size 0 and trigger kernel stack dump

Solution:
Check size before calling vzalloc

Verify:
U212

Change-Id: Ida349c310c1e7f9a644a99ff32457984aca70dee
Signed-off-by: Song Zhao <song.zhao@amlogic.com>
drivers/amvdec_ports/decoder/vdec_vp9_if.c

index 0a5ceda4bb47b3276c6ed20e63810bcdc09338c6..9882b4765fe2440f162f75a7e68d3fa0acf0a959 100644 (file)
@@ -622,6 +622,8 @@ static void add_prefix_data(struct vp9_superframe_split *s,
        u32 length;
 
        length = s->size + s->nb_frames * PREFIX_SIZE;
+       if (!length)
+               return;
        p = vzalloc(length);
        if (!p) {
                v4l_dbg(0, V4L_DEBUG_CODEC_ERROR,