linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: renesas:fix possible null pointer dereference struct pinmux_range *
@ 2021-02-07 15:07 alex_luca
  2021-02-09 14:12 ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: alex_luca @ 2021-02-07 15:07 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linus Walleij, linux-renesas-soc, linux-gpio, linux-kernel,
	alex_luca, Zhang Kun

From: Zhang Kun <zhangkun@cdjrlc.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@cdjrlc.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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-09 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-07 15:07 [PATCH] pinctrl: renesas:fix possible null pointer dereference struct pinmux_range * alex_luca
2021-02-09 14:12 ` Geert Uytterhoeven
2021-02-09 14:26   ` Alex

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).