mirror of
https://github.com/LineageOS/android_kernel_fxtec_sm6115.git
synced 2026-04-24 07:26:48 +00:00
pinctrl: check the return value of pinmux_ops::get_function_name()
commit 4002ee98c022d671ecc1e4a84029e9ae7d8a5603 upstream. While the API contract in docs doesn't specify it explicitly, the generic implementation of the get_function_name() callback from struct pinmux_ops - pinmux_generic_get_function_name() - can fail and return NULL. This is already checked in pinmux_check_ops() so add a similar check in pinmux_func_name_to_selector() instead of passing the returned pointer right down to strcmp() where the NULL can get dereferenced. This is normal operation when adding new pinfunctions. Cc: stable@vger.kernel.org Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
This commit is contained in:
committed by
Ulrich Hecht
parent
1802457ef8
commit
2f296b0f71
@ -301,7 +301,7 @@ static int pinmux_func_name_to_selector(struct pinctrl_dev *pctldev,
|
||||
while (selector < nfuncs) {
|
||||
const char *fname = ops->get_function_name(pctldev, selector);
|
||||
|
||||
if (!strcmp(function, fname))
|
||||
if (fname && !strcmp(function, fname))
|
||||
return selector;
|
||||
|
||||
selector++;
|
||||
|
||||
Reference in New Issue
Block a user