* [PATCH] pinctrl: fix signed vs unsigned conditional inside pinmux_map_to_setting
@ 2012-04-23 8:12 John Crispin
[not found] ` <1335168743-3868-1-git-send-email-blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: John Crispin @ 2012-04-23 8:12 UTC (permalink / raw)
To: Linus Walleij; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Dong Aisheng
pinmux_map_to_settingi() uses setting->data.mux.func to store the return code of
pinmux_func_name_to_selector(). However, struct pinctrl_setting_mux defines the
func element as unsigned, resulting in all error codes getting lost. The
conditional following the assignment will always evaluate to false thus breaking
the error path.
This bug can be triggered by loading a pinmux group map from the devicetree
with an invalid function string.
Signed-off-by: John Crispin <blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
Cc: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Dong Aisheng <dong.aisheng-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
drivers/pinctrl/pinmux.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index c494c37..cd377a2 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -328,10 +328,10 @@ int pinmux_map_to_setting(struct pinctrl_map const *map,
return -EINVAL;
}
- setting->data.mux.func =
- pinmux_func_name_to_selector(pctldev, map->data.mux.function);
- if (setting->data.mux.func < 0)
- return setting->data.mux.func;
+ ret = pinmux_func_name_to_selector(pctldev, map->data.mux.function);
+ if (ret < 0)
+ return ret;
+ setting->data.mux.func = ret;
ret = pmxops->get_function_groups(pctldev, setting->data.mux.func,
&groups, &num_groups);
--
1.7.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-23 15:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-23 8:12 [PATCH] pinctrl: fix signed vs unsigned conditional inside pinmux_map_to_setting John Crispin
[not found] ` <1335168743-3868-1-git-send-email-blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2012-04-23 15:52 ` Stephen Warren
[not found] ` <4F957ADA.9000203-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-04-23 15:59 ` John Crispin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.