2018-09-06 12:14:25

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH] memory: ti-aemif: fix a potential NULL-pointer dereference

From: Bartosz Golaszewski <[email protected]>

Platform data pointer may be NULL. We check it everywhere but in one
place. Fix it.

Fixes: 8af70cd2ca50 ("memory: aemif: add support for board files")
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
Cc: [email protected]
---
drivers/memory/ti-aemif.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c
index 31112f622b88..475e5b3790ed 100644
--- a/drivers/memory/ti-aemif.c
+++ b/drivers/memory/ti-aemif.c
@@ -411,7 +411,7 @@ static int aemif_probe(struct platform_device *pdev)
if (ret < 0)
goto error;
}
- } else {
+ } else if (pdata) {
for (i = 0; i < pdata->num_sub_devices; i++) {
pdata->sub_devices[i].dev.parent = dev;
ret = platform_device_register(&pdata->sub_devices[i]);
--
2.18.0



2018-09-06 17:01:22

by Santosh Shilimkar

[permalink] [raw]
Subject: Re: [PATCH] memory: ti-aemif: fix a potential NULL-pointer dereference

Hi Arnd, Olof,

On 9/6/2018 5:12 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <[email protected]>
>
> Platform data pointer may be NULL. We check it everywhere but in one
> place. Fix it.
>
> Fixes: 8af70cd2ca50 ("memory: aemif: add support for board files")
> Reported-by: Dan Carpenter <[email protected]>
> Signed-off-by: Bartosz Golaszewski <[email protected]>
> Cc: [email protected]
> ---
> drivers/memory/ti-aemif.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Will you be able to push this via drivers-soc fixes ?

Regards,
Santosh

2018-09-06 17:08:07

by Olof Johansson

[permalink] [raw]
Subject: Re: [PATCH] memory: ti-aemif: fix a potential NULL-pointer dereference

On Thu, Sep 06, 2018 at 09:58:54AM -0700, Santosh Shilimkar wrote:
> Hi Arnd, Olof,
>
> On 9/6/2018 5:12 AM, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <[email protected]>
> >
> > Platform data pointer may be NULL. We check it everywhere but in one
> > place. Fix it.
> >
> > Fixes: 8af70cd2ca50 ("memory: aemif: add support for board files")
> > Reported-by: Dan Carpenter <[email protected]>
> > Signed-off-by: Bartosz Golaszewski <[email protected]>
> > Cc: [email protected]
> > ---
> > drivers/memory/ti-aemif.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> Will you be able to push this via drivers-soc fixes ?

Applied to fixes.


-Olof

2018-09-06 21:05:25

by Santosh Shilimkar

[permalink] [raw]
Subject: Re: [PATCH] memory: ti-aemif: fix a potential NULL-pointer dereference

On 9/6/2018 10:03 AM, Olof Johansson wrote:
> On Thu, Sep 06, 2018 at 09:58:54AM -0700, Santosh Shilimkar wrote:
>> Hi Arnd, Olof,
>>
>> On 9/6/2018 5:12 AM, Bartosz Golaszewski wrote:
>>> From: Bartosz Golaszewski <[email protected]>
>>>
>>> Platform data pointer may be NULL. We check it everywhere but in one
>>> place. Fix it.
>>>
>>> Fixes: 8af70cd2ca50 ("memory: aemif: add support for board files")
>>> Reported-by: Dan Carpenter <[email protected]>
>>> Signed-off-by: Bartosz Golaszewski <[email protected]>
>>> Cc: [email protected]
>>> ---
>>> drivers/memory/ti-aemif.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>> Will you be able to push this via drivers-soc fixes ?
>
> Applied to fixes.
>
Thanks Olof !!

Regards,
Santosh