diff mbox

video: fbdev: pxafb: fix out of memory error path

Message ID 1450527271-21841-1-git-send-email-robert.jarzmik@free.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Jarzmik Dec. 19, 2015, 12:14 p.m. UTC
As seen by Julia, the initial allocation memory is not checked anymore
after commit "video: fbdev: pxafb: initial devicetree conversion".
Introduce back the removed test.

Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/video/fbdev/pxafb.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Robert Jarzmik Jan. 10, 2016, 8:27 p.m. UTC | #1
Robert Jarzmik <robert.jarzmik@free.fr> writes:

> As seen by Julia, the initial allocation memory is not checked anymore
> after commit "video: fbdev: pxafb: initial devicetree conversion".
> Introduce back the removed test.
>
> Reported-by: Julia Lawall <julia.lawall@lip6.fr>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
>  drivers/video/fbdev/pxafb.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
> index 8588dd683105..54666424a720 100644
> --- a/drivers/video/fbdev/pxafb.c
> +++ b/drivers/video/fbdev/pxafb.c
> @@ -2252,6 +2252,8 @@ static int pxafb_probe(struct platform_device *dev)
>  	ret = -ENOMEM;
>  	pdata = dev_get_platdata(&dev->dev);
>  	inf = devm_kmalloc(&dev->dev, sizeof(*inf), GFP_KERNEL);
> +	if (!inf)
> +		goto failed;
>  
>  	if (pdata) {
>  		*inf = *pdata;
Tomi, Jean-Christophe,

Can you carry out this fix please ?

Cheers.
Tomi Valkeinen Jan. 11, 2016, 11:51 a.m. UTC | #2
On 10/01/16 22:27, Robert Jarzmik wrote:
> Robert Jarzmik <robert.jarzmik@free.fr> writes:
> 
>> As seen by Julia, the initial allocation memory is not checked anymore
>> after commit "video: fbdev: pxafb: initial devicetree conversion".
>> Introduce back the removed test.
>>
>> Reported-by: Julia Lawall <julia.lawall@lip6.fr>
>> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
>> ---
>>  drivers/video/fbdev/pxafb.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
>> index 8588dd683105..54666424a720 100644
>> --- a/drivers/video/fbdev/pxafb.c
>> +++ b/drivers/video/fbdev/pxafb.c
>> @@ -2252,6 +2252,8 @@ static int pxafb_probe(struct platform_device *dev)
>>  	ret = -ENOMEM;
>>  	pdata = dev_get_platdata(&dev->dev);
>>  	inf = devm_kmalloc(&dev->dev, sizeof(*inf), GFP_KERNEL);
>> +	if (!inf)
>> +		goto failed;
>>  
>>  	if (pdata) {
>>  		*inf = *pdata;
> Tomi, Jean-Christophe,
> 
> Can you carry out this fix please ?

Thanks, queued for 4.5.

 Tomi
diff mbox

Patch

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index 8588dd683105..54666424a720 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -2252,6 +2252,8 @@  static int pxafb_probe(struct platform_device *dev)
 	ret = -ENOMEM;
 	pdata = dev_get_platdata(&dev->dev);
 	inf = devm_kmalloc(&dev->dev, sizeof(*inf), GFP_KERNEL);
+	if (!inf)
+		goto failed;
 
 	if (pdata) {
 		*inf = *pdata;