Skip to content

Commit 9063777

Browse files
xiaoleiwang123456linusw
authored andcommitted
pinctrl: freescale: Fix a memory out of bounds when num_configs is 1
The config passed in by pad wakeup is 1, when num_configs is 1, Configuration [1] should not be fetched, which will be detected by KASAN as a memory out of bounds condition. Modify to get configs[1] when num_configs is 2. Fixes: f60c9ea ("gpio: mxc: enable pad wakeup on i.MX8x platforms") Signed-off-by: Xiaolei Wang <[email protected]> Reviewed-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 4e73980 commit 9063777

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/pinctrl/freescale/pinctrl-scu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
9090
struct imx_sc_msg_req_pad_set msg;
9191
struct imx_sc_rpc_msg *hdr = &msg.hdr;
9292
unsigned int mux = configs[0];
93-
unsigned int conf = configs[1];
93+
unsigned int conf;
9494
unsigned int val;
9595
int ret;
9696

@@ -115,6 +115,7 @@ int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
115115
* Set mux and conf together in one IPC call
116116
*/
117117
WARN_ON(num_configs != 2);
118+
conf = configs[1];
118119

119120
val = conf | BM_PAD_CTL_IFMUX_ENABLE | BM_PAD_CTL_GP_ENABLE;
120121
val |= mux << BP_PAD_CTL_IFMUX;

0 commit comments

Comments
 (0)