2022-02-25 15:58:48

by Jia-Ju Bai

[permalink] [raw]
Subject: [PATCH] memory: emif: check the pointer temp in get_device_details()

The pointer temp is allocated by devm_kzalloc(), so it should be
checked for error handling.

Fixes: 7ec944538dde ("memory: emif: add basic infrastructure for EMIF driver")
Reported-by: TOTE Robot <[email protected]>
Signed-off-by: Jia-Ju Bai <[email protected]>
---
drivers/memory/emif.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c
index 762d0c0f0716..93a79346a11e 100644
--- a/drivers/memory/emif.c
+++ b/drivers/memory/emif.c
@@ -1025,7 +1025,7 @@ static struct emif_data *__init_or_module get_device_details(
temp = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
dev_info = devm_kzalloc(dev, sizeof(*dev_info), GFP_KERNEL);

- if (!emif || !pd || !dev_info) {
+ if (!emif || !temp || !dev_info) {
dev_err(dev, "%s:%d: allocation error\n", __func__, __LINE__);
goto error;
}
--
2.17.1


2022-02-25 20:18:31

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH] memory: emif: check the pointer temp in get_device_details()

On 25/02/2022 14:25, Jia-Ju Bai wrote:
> The pointer temp is allocated by devm_kzalloc(), so it should be
> checked for error handling.
>
> Fixes: 7ec944538dde ("memory: emif: add basic infrastructure for EMIF driver")
> Reported-by: TOTE Robot <[email protected]>

I cannot find this report. This is an open source work and public
collaboration. The “Reported-by” usually means that the issue was
reported. Usually in public. Can we see the report?


Best regards,
Krzysztof

2022-03-04 13:10:08

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH] memory: emif: check the pointer temp in get_device_details()

On Fri, 25 Feb 2022 05:25:52 -0800, Jia-Ju Bai wrote:
> The pointer temp is allocated by devm_kzalloc(), so it should be
> checked for error handling.
>
>

Applied, thanks!

[1/1] memory: emif: check the pointer temp in get_device_details()
commit: 5b5ab1bfa1898c6d52936a57c25c5ceba2cb2f87

Best regards,
--
Krzysztof Kozlowski <[email protected]>