MLK-21590 epdc: fix potential out of array boundary access
authorRobby Cai <robby.cai@nxp.com>
Sun, 28 Apr 2019 08:28:47 +0000 (16:28 +0800)
committerRobby Cai <robby.cai@nxp.com>
Sun, 28 Apr 2019 09:22:46 +0000 (17:22 +0800)
commit9d07c19d01a97ca7e5570a1cd4681ad600d0486e
tree5fe1926aa782993bd88187f4181f6bad250677d3
parenta211ed52f69fc8c344dd9ac143dd5d9ee54ea463
MLK-21590 epdc: fix potential out of array boundary access

The function mxc_epdc_fb_init_hw() could be called more than once when load
the firmware due to some reason. If this case happens, then for following codes,
the array fb_data->fw_str pointed to will be accessed out of bound. It probably
causes kernel crash, or makes fb_data->fw_str get a wrong value, then the driver
may be stuck during the process of loading the firmware.

        if (fb_data->cur_mode) {
                strcat(fb_data->fw_str, "imx/epdc/epdc_");
                strcat(fb_data->fw_str, fb_data->cur_mode->vmode->name);
                strcat(fb_data->fw_str, ".fw");
        }

This patch fixed that by using strcpy instread.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
drivers/video/fbdev/mxc/mxc_epdc_fb.c
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c