From: Ciprian Costea <[email protected]>

commit 89bfcb2f020453200d2eb9542fe327a048df8276 from
https://github.com/nxp-auto-linux/linux

Issue: ALB-9905
Signed-off-by: Ciprian Costea <[email protected]>
Signed-off-by: Zhantao Tang <[email protected]>
---
 drivers/pinctrl/freescale/pinctrl-s32cc-core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-s32cc-core.c 
b/drivers/pinctrl/freescale/pinctrl-s32cc-core.c
index 6bb8ac1f5c42..41e31b95e5a7 100644
--- a/drivers/pinctrl/freescale/pinctrl-s32cc-core.c
+++ b/drivers/pinctrl/freescale/pinctrl-s32cc-core.c
@@ -3,7 +3,7 @@
  * Core driver for the S32CC pin controller
  *
  * Copyright 2015-2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018, 2020-2022 NXP
+ * Copyright 2017-2018, 2020-2023 NXP
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -933,6 +933,10 @@ static int s32cc_pinctrl_parse_functions(struct 
device_node *np,
                        func->num_groups * sizeof(char *), GFP_KERNEL);
 
        for_each_child_of_node(np, child) {
+               if (info->grp_index >= info->ngroups) {
+                       dev_err(info->dev, "Invalid grp_index: %d\n", 
info->grp_index);
+                       return -EINVAL;
+               }
                func->groups[i] = child->name;
                grp = &info->groups[info->grp_index++];
                s32cc_pinctrl_parse_groups(child, grp, info, i++);
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12331): 
https://lists.yoctoproject.org/g/linux-yocto/message/12331
Mute This Topic: https://lists.yoctoproject.org/mt/97945967/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to