amvecm: DNLP curve read error [1/1]
authorMingLiang Dong <mingliang.dong@amlogic.com>
Mon, 14 Jan 2019 06:07:07 +0000 (01:07 -0500)
committerJianxin Pan <jianxin.pan@amlogic.com>
Wed, 16 Jan 2019 02:13:44 +0000 (18:13 -0800)
PD#SWPL-4139

Problem:
DNLP curve buffer is not clean

Solution:
memset dnlp curve buf 0

Verify:
verify on TL1

Change-Id: Ibf37a8bfa52cdcb2d8c848c94a0d32d0391c8742
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
drivers/amlogic/media/enhancement/amvecm/amvecm.c

index 5dc09d6..acb7012 100644 (file)
@@ -1698,9 +1698,11 @@ static void d_convert_str(int num,
 
        if (bit_chose == 10)
                snprintf(buf, sizeof(buf), "%d", num);
-       if (bit_chose == 16)
+       else if (bit_chose == 16)
                snprintf(buf, sizeof(buf), "%x", num);
        count = strlen(buf);
+       if (count > 4)
+               count = 4;
        for (i = 0; i < count; i++)
                buf[i + char_bit] = buf[i];
        for (i = 0; i < char_bit; i++)
@@ -1733,6 +1735,8 @@ static ssize_t amvecm_dnlp_debug_store(struct class *cla,
        stemp = kmalloc(400, GFP_KERNEL);
        if (!stemp)
                return 0;
+       memset(stemp, 0, 400);
+
        buf_orig = kstrdup(buf, GFP_KERNEL);
        parse_param_amvecm(buf_orig, (char **)&parm);