soc: swr-mstr: Add out-of-bound check
Update out-of-bound check in parse swr port mapping. Change-Id: I3735ff68c293fdb96dd7b004438faa999195adb2 Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
This commit is contained in:
@@ -2792,6 +2792,13 @@ static int swrm_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
if (port_num != old_port_num)
|
if (port_num != old_port_num)
|
||||||
ch_iter = 0;
|
ch_iter = 0;
|
||||||
|
if (port_num > SWR_MSTR_PORT_LEN ||
|
||||||
|
ch_iter >= SWR_MAX_CH_PER_PORT) {
|
||||||
|
dev_err(&pdev->dev,
|
||||||
|
"%s:invalid port_num %d or ch_iter %d\n",
|
||||||
|
__func__, port_num, ch_iter);
|
||||||
|
goto err_pdata_fail;
|
||||||
|
}
|
||||||
swrm->port_mapping[port_num][ch_iter].port_type = port_type;
|
swrm->port_mapping[port_num][ch_iter].port_type = port_type;
|
||||||
swrm->port_mapping[port_num][ch_iter++].ch_mask = ch_mask;
|
swrm->port_mapping[port_num][ch_iter++].ch_mask = ch_mask;
|
||||||
old_port_num = port_num;
|
old_port_num = port_num;
|
||||||
|
@@ -171,7 +171,7 @@ struct swr_mstr_ctrl {
|
|||||||
struct work_struct dc_presence_work;
|
struct work_struct dc_presence_work;
|
||||||
u8 num_ports;
|
u8 num_ports;
|
||||||
struct swrm_port_type
|
struct swrm_port_type
|
||||||
port_mapping[SWR_MSTR_PORT_LEN][SWR_MAX_CH_PER_PORT];
|
port_mapping[SWR_MSTR_PORT_LEN + 1][SWR_MAX_CH_PER_PORT];
|
||||||
int swr_irq;
|
int swr_irq;
|
||||||
u32 clk_stop_mode0_supp;
|
u32 clk_stop_mode0_supp;
|
||||||
struct work_struct wakeup_work;
|
struct work_struct wakeup_work;
|
||||||
|
Reference in New Issue
Block a user