# \[patch\] video: fbdev: pxafb: potential NULL dereference on error

- Subsystems: FRAMEBUFFER LAYER, THE REST
- Maintainers: Helge Deller, Linus Torvalds
- List: linux-fbdev
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-fbdev/2016/07/4795744/t

## \[patch\] video: fbdev: pxafb: potential NULL dereference on error

- From: Dan Carpenter \<hidden\>
- Date: 2016-07-15 11:10:49 
- Message: https://ratatoskr.run/linux-fbdev/2016/07/4795744.md

```text
If we "goto out;" then it calls display_timings_release(timings);
Since "timings" is NULL, that's going to oops.  Just return directly.

Fixes: 420a488278e8 ('video: fbdev: pxafb: initial devicetree conversion')
Signed-off-by: Dan Carpenter <redacted>

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index 2c0487f..ed41fdb 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -2125,7 +2125,7 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
 
 	timings = of_get_display_timings(disp);
 	if (!timings)
-		goto out;
+		return -EINVAL;
 
 	ret = -ENOMEM;
 	info->modes = kmalloc_array(timings->num_timings,
```

## Re: \[patch\] video: fbdev: pxafb: potential NULL dereference on error

- From: Tomi Valkeinen \<hidden\>
- Date: 2016-08-10 19:55:06 
- Message: https://ratatoskr.run/linux-fbdev/2016/08/4811556.md

```text

On 15/07/16 14:07, Dan Carpenter wrote:
> If we "goto out;" then it calls display_timings_release(timings);
> Since "timings" is NULL, that's going to oops.  Just return directly.
> 
> Fixes: 420a488278e8 ('video: fbdev: pxafb: initial devicetree conversion')
> Signed-off-by: Dan Carpenter <redacted>
> 
> diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
> index 2c0487f..ed41fdb 100644
> --- a/drivers/video/fbdev/pxafb.c
> +++ b/drivers/video/fbdev/pxafb.c
> @@ -2125,7 +2125,7 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
>  
>  	timings = of_get_display_timings(disp);
>  	if (!timings)
> -		goto out;
> +		return -EINVAL;
>  
>  	ret = -ENOMEM;
>  	info->modes = kmalloc_array(timings->num_timings,
> 

Thanks, queued for v4.9.

 Tomi

```
