Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pinctrl: core: handle radix_tree_insert() errors in pinctrl_generic_add_group()

pinctrl_generic_add_group() doesn't check the result of radix_tree_insert()
despite they both may return a negative error code. Linus Walleij said he
has copied the radix tree code from kernel/irq/ where the functions calling
radix_tree_insert() are *void* themselves; I think it makes more sense to
propagate the errors from radix_tree_insert() upstream if we can do that...

Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Link: https://lore.kernel.org/r/20230719202253.13469-2-s.shtylyov@omp.ru
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Sergey Shtylyov and committed by
Linus Walleij
b56e23bf 87b549ef

+4 -2
+4 -2
drivers/pinctrl/core.c
··· 633 633 int *pins, int num_pins, void *data) 634 634 { 635 635 struct group_desc *group; 636 - int selector; 636 + int selector, error; 637 637 638 638 if (!name) 639 639 return -EINVAL; ··· 653 653 group->num_pins = num_pins; 654 654 group->data = data; 655 655 656 - radix_tree_insert(&pctldev->pin_group_tree, selector, group); 656 + error = radix_tree_insert(&pctldev->pin_group_tree, selector, group); 657 + if (error) 658 + return error; 657 659 658 660 pctldev->num_groups++; 659 661