lkml.org 
[lkml]   [2021]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] pinctrl: renesas:fix possible null pointer dereference struct pinmux_range *
Date
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

\
 
 \ /
  Last update: 2021-02-07 18:46    [W:0.041 / U:1.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site