* [PATCH] pinctrl: Add check for kcalloc
@ 2022-07-10 15:48 williamsukatube
2022-07-11 13:04 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: williamsukatube @ 2022-07-10 15:48 UTC (permalink / raw)
To: dvorkin, wellslutw, linus.walleij, linux-arm-kernel, linux-gpio,
linux-kernel
Cc: William Dean, Hacash Robot
From: William Dean <williamsukatube@gmail.com>
As the potential failure of the kcalloc(),
it should be better to check it in order to
avoid the dereference of the NULL pointer.
Fixes: aa74c44be19c8 ("pinctrl: Add driver for Sunplus SP7021")
Reported-by: Hacash Robot <hacashRobot@santino.com>
Signed-off-by: William Dean <williamsukatube@gmail.com>
---
drivers/pinctrl/sunplus/sppctl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/sunplus/sppctl.c b/drivers/pinctrl/sunplus/sppctl.c
index 3ba47040ac42..2b3335ab56c6 100644
--- a/drivers/pinctrl/sunplus/sppctl.c
+++ b/drivers/pinctrl/sunplus/sppctl.c
@@ -871,6 +871,9 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node
}
*map = kcalloc(*num_maps + nmG, sizeof(**map), GFP_KERNEL);
+ if (*map == NULL)
+ return -ENOMEM;
+
for (i = 0; i < (*num_maps); i++) {
dt_pin = be32_to_cpu(list[i]);
pin_num = FIELD_GET(GENMASK(31, 24), dt_pin);
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: Add check for kcalloc
2022-07-10 15:48 [PATCH] pinctrl: Add check for kcalloc williamsukatube
@ 2022-07-11 13:04 ` Linus Walleij
2022-07-12 8:06 ` William Dean
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2022-07-11 13:04 UTC (permalink / raw)
To: williamsukatube
Cc: dvorkin, wellslutw, linux-arm-kernel, linux-gpio, linux-kernel,
William Dean, Hacash Robot
On Sun, Jul 10, 2022 at 5:48 PM <williamsukatube@163.com> wrote:
> From: William Dean <williamsukatube@gmail.com>
>
> As the potential failure of the kcalloc(),
> it should be better to check it in order to
> avoid the dereference of the NULL pointer.
>
> Fixes: aa74c44be19c8 ("pinctrl: Add driver for Sunplus SP7021")
> Reported-by: Hacash Robot <hacashRobot@santino.com>
> Signed-off-by: William Dean <williamsukatube@gmail.com>
Patch applied, tweaked the subject a bit,
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: Add check for kcalloc
2022-07-11 13:04 ` Linus Walleij
@ 2022-07-12 8:06 ` William Dean
0 siblings, 0 replies; 3+ messages in thread
From: William Dean @ 2022-07-12 8:06 UTC (permalink / raw)
To: Linus Walleij
Cc: williamsukatube, dvorkin, wellslutw, linux-arm-kernel,
linux-gpio, linux-kernel, Hacash Robot
thx :)
Linus Walleij <linus.walleij@linaro.org> 于2022年7月11日周一 21:04写道:
>
> On Sun, Jul 10, 2022 at 5:48 PM <williamsukatube@163.com> wrote:
>
> > From: William Dean <williamsukatube@gmail.com>
> >
> > As the potential failure of the kcalloc(),
> > it should be better to check it in order to
> > avoid the dereference of the NULL pointer.
> >
> > Fixes: aa74c44be19c8 ("pinctrl: Add driver for Sunplus SP7021")
> > Reported-by: Hacash Robot <hacashRobot@santino.com>
> > Signed-off-by: William Dean <williamsukatube@gmail.com>
>
> Patch applied, tweaked the subject a bit,
>
> Yours,
> Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-12 8:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-10 15:48 [PATCH] pinctrl: Add check for kcalloc williamsukatube
2022-07-11 13:04 ` Linus Walleij
2022-07-12 8:06 ` William Dean
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).