[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210207150736.24382-1-alex_luca@163.com>
Date: Sun, 7 Feb 2021 23:07:36 +0800
From: alex_luca@....com
To: Geert Uytterhoeven <geert+renesas@...der.be>
Cc: Linus Walleij <linus.walleij@...aro.org>,
linux-renesas-soc@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org, alex_luca@....com,
Zhang Kun <zhangkun@...rlc.com>
Subject: [PATCH] pinctrl: renesas:fix possible null pointer dereference struct pinmux_range *
From: Zhang Kun <zhangkun@...rlc.com>
The parameters of sh_pfc_enum_in_range() pinmux_range *r should be checked
first for possible null ponter, especially when PINMUX_TYPE_FUNCTION as the
pinmux_type was passed by sh_pfc_config_mux().
Signed-off-by: Zhang Kun <zhangkun@...rlc.com>
---
drivers/pinctrl/renesas/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/renesas/core.c b/drivers/pinctrl/renesas/core.c
index 2cc457279345..40bbc8366668 100644
--- a/drivers/pinctrl/renesas/core.c
+++ b/drivers/pinctrl/renesas/core.c
@@ -128,6 +128,9 @@ int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin)
static int sh_pfc_enum_in_range(u16 enum_id, const struct pinmux_range *r)
{
+ if (!r)
+ return 0;
+
if (enum_id < r->begin)
return 0;
--
2.17.1
Powered by blists - more mailing lists