* [PATCH] pinctrl: aspeed: fix null dereference in debug
@ 2022-03-01 19:30 Weiguo Li
2022-03-02 0:09 ` Andrew Jeffery
2022-03-03 5:52 ` [PATCH] " Petr Vorel
0 siblings, 2 replies; 4+ messages in thread
From: Weiguo Li @ 2022-03-01 19:30 UTC (permalink / raw)
To: andrew; +Cc: joel, linux-aspeed, linux-gpio
"pdesc" is null checked, but already dereferenced ahead in debug.
Swap their positions to avoid potential null dereference.
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
drivers/pinctrl/aspeed/pinctrl-aspeed.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
index c94e24aadf92..83d47ff1cea8 100644
--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
@@ -236,11 +236,11 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
const struct aspeed_sig_expr **funcs;
const struct aspeed_sig_expr ***prios;
- pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
-
if (!pdesc)
return -EINVAL;
+ pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
+
prios = pdesc->prios;
if (!prios)
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: aspeed: fix null dereference in debug
2022-03-01 19:30 [PATCH] pinctrl: aspeed: fix null dereference in debug Weiguo Li
@ 2022-03-02 0:09 ` Andrew Jeffery
2022-03-02 7:12 ` [PATCH v2] " Weiguo Li
2022-03-03 5:52 ` [PATCH] " Petr Vorel
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Jeffery @ 2022-03-02 0:09 UTC (permalink / raw)
To: Weiguo Li; +Cc: Joel Stanley, linux-aspeed, linux-gpio
On Wed, 2 Mar 2022, at 06:00, Weiguo Li wrote:
> "pdesc" is null checked, but already dereferenced ahead in debug.
> Swap their positions to avoid potential null dereference.
>
> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Thanks.
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
> ---
> drivers/pinctrl/aspeed/pinctrl-aspeed.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> index c94e24aadf92..83d47ff1cea8 100644
> --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> @@ -236,11 +236,11 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev
> *pctldev, unsigned int function,
> const struct aspeed_sig_expr **funcs;
> const struct aspeed_sig_expr ***prios;
>
> - pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
> -
> if (!pdesc)
> return -EINVAL;
>
> + pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
> +
> prios = pdesc->prios;
>
> if (!prios)
> --
> 2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] pinctrl: aspeed: fix null dereference in debug
2022-03-02 0:09 ` Andrew Jeffery
@ 2022-03-02 7:12 ` Weiguo Li
0 siblings, 0 replies; 4+ messages in thread
From: Weiguo Li @ 2022-03-02 7:12 UTC (permalink / raw)
To: andrew; +Cc: joel, linux-aspeed, linux-gpio
"pdesc" is null checked, but already dereferenced ahead in debug.
Swap their positions to avoid potential null dereference.
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
---
v2:
* resend it after registering an account in aspeed patchwork
---
drivers/pinctrl/aspeed/pinctrl-aspeed.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
index c94e24aadf92..83d47ff1cea8 100644
--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
@@ -236,11 +236,11 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
const struct aspeed_sig_expr **funcs;
const struct aspeed_sig_expr ***prios;
- pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
-
if (!pdesc)
return -EINVAL;
+ pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
+
prios = pdesc->prios;
if (!prios)
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: aspeed: fix null dereference in debug
2022-03-01 19:30 [PATCH] pinctrl: aspeed: fix null dereference in debug Weiguo Li
2022-03-02 0:09 ` Andrew Jeffery
@ 2022-03-03 5:52 ` Petr Vorel
1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2022-03-03 5:52 UTC (permalink / raw)
To: Weiguo Li; +Cc: andrew, linux-gpio, linux-aspeed
Hi Weiguo,
LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-03 5:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-01 19:30 [PATCH] pinctrl: aspeed: fix null dereference in debug Weiguo Li
2022-03-02 0:09 ` Andrew Jeffery
2022-03-02 7:12 ` [PATCH v2] " Weiguo Li
2022-03-03 5:52 ` [PATCH] " Petr Vorel
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).