Skip to content

Commit 84a85d3

Browse files
Lotte-BaiLinus Walleij
authored andcommitted
pinctrl: aspeed: Fix potential NULL dereference in aspeed_pinmux_set_mux()
pdesc could be null but still dereference pdesc->name and it will lead to a null pointer access. So we move a null check before dereference. Signed-off-by: Haowen Bai <baihaowen@meizu.com> Link: https://lore.kernel.org/r/1650508019-22554-1-git-send-email-baihaowen@meizu.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent f2906aa commit 84a85d3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/pinctrl/aspeed/pinctrl-aspeed.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
236236
const struct aspeed_sig_expr **funcs;
237237
const struct aspeed_sig_expr ***prios;
238238

239-
pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
240-
241239
if (!pdesc)
242240
return -EINVAL;
243241

242+
pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
243+
244244
prios = pdesc->prios;
245245

246246
if (!prios)

0 commit comments

Comments
 (0)