MLK-12670 mxc IPUv3: common: Fix overrun array ->sec_chan_en and ->thrd_chan_en
authorLiu Ying <victor.liu@nxp.com>
Mon, 18 Apr 2016 02:12:39 +0000 (10:12 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:51:49 +0000 (14:51 -0500)
commit87c34f91f353d450dc43607370755076053e67f0
treedc3b5e25264b77fe081ff5965d99c041e58e2e66
parenta956eac3e072c507fc6361bce426352dd8982062
MLK-12670 mxc IPUv3: common: Fix overrun array ->sec_chan_en and ->thrd_chan_en

We've got more than 24 channels defined in ipu_channel_t, which causes
potential overrun on array ipu->sec_chan_en and ipu->thrd_chan_en.
This patch enlarges the array size to IPU_MAX_CH(32) to fix this issue.

This issue is reported by Coverity:
Out-of-bounds read (OVERRUN)
overrun-local: Overrunning array ipu->sec_chan_en of 24 bytes at byte offset
25 using index channel >> 24 (which evaluates to 25).
        if ((ipu->sec_chan_en[IPU_CHAN_ID(channel)]) &&
                ((channel == MEM_PP_MEM) || (channel == MEM_PRP_VF_MEM) ||
                 (channel == MEM_VDI_PRP_VF_MEM))) {

Out-of-bounds read (OVERRUN)
overrun-local: Overrunning array ipu->thrd_chan_en of 24 bytes at byte offset
25 using index channel >> 24 (which evaluates to 25).
        if ((ipu->thrd_chan_en[IPU_CHAN_ID(channel)]) &&
                ((channel == MEM_PP_MEM) || (channel == MEM_PRP_VF_MEM))) {
                thrd_dma = channel_2_dma(channel, IPU_ALPHA_IN_BUFFER);

Signed-off-by: Liu Ying <victor.liu@nxp.com>
drivers/mxc/ipu3/ipu_prv.h