Commit 84a85d3f authored by Haowen Bai's avatar Haowen Bai Committed by Linus Walleij
Browse files

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: default avatarHaowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1650508019-22554-1-git-send-email-baihaowen@meizu.com


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent f2906aa8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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)