linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data"
@ 2018-11-16 11:02 ` YueHaibing
  2018-11-16 20:05   ` Daniel Mack
  2018-12-20 16:55   ` Bartlomiej Zolnierkiewicz
  0 siblings, 2 replies; 5+ messages in thread
From: YueHaibing @ 2018-11-16 11:02 UTC (permalink / raw)
  To: b.zolnierkie, daniel, robert.jarzmik
  Cc: linux-kernel, linux-fbdev, dri-devel, YueHaibing

'info->modes' got allocated with devm_kcalloc in of_get_pxafb_display.

This gives this error message:
  ./drivers/video/fbdev/pxafb.c:2238:2-7: WARNING: invalid free of devm_ allocated data

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/video/fbdev/pxafb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index bbed039..d59c8a5 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -2234,10 +2234,8 @@ static struct pxafb_mach_info *of_pxafb_of_mach_info(struct device *dev)
 	if (!info)
 		return ERR_PTR(-ENOMEM);
 	ret = of_get_pxafb_mode_info(dev, info);
-	if (ret) {
-		kfree(info->modes);
+	if (ret)
 		return ERR_PTR(ret);
-	}
 
 	/*
 	 * On purpose, neither lccrX registers nor video memory size can be
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data"
  2018-11-16 11:02 ` [PATCH -next] video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data" YueHaibing
@ 2018-11-16 20:05   ` Daniel Mack
  2018-11-19  1:23     ` YueHaibing
  2018-12-20 16:55   ` Bartlomiej Zolnierkiewicz
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Mack @ 2018-11-16 20:05 UTC (permalink / raw)
  To: YueHaibing, b.zolnierkie, robert.jarzmik
  Cc: linux-kernel, linux-fbdev, dri-devel

On 16/11/2018 12:02 PM, YueHaibing wrote:
> 'info->modes' got allocated with devm_kcalloc in of_get_pxafb_display.
> 
> This gives this error message:
>    ./drivers/video/fbdev/pxafb.c:2238:2-7: WARNING: invalid free of devm_ allocated data
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Oh, yes. Thanks for spotting this!

Could you please add these lines to the patch and resubmit?


Fixes: c8f96304ec8b4 ("video: fbdev: pxafb: switch to devm_* API")
Cc: stable@kernel.org [v4.19+]
Reviewed-by: Daniel Mack <daniel@zonque.org>




> ---
>   drivers/video/fbdev/pxafb.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
> index bbed039..d59c8a5 100644
> --- a/drivers/video/fbdev/pxafb.c
> +++ b/drivers/video/fbdev/pxafb.c
> @@ -2234,10 +2234,8 @@ static struct pxafb_mach_info *of_pxafb_of_mach_info(struct device *dev)
>   	if (!info)
>   		return ERR_PTR(-ENOMEM);
>   	ret = of_get_pxafb_mode_info(dev, info);
> -	if (ret) {
> -		kfree(info->modes);
> +	if (ret)
>   		return ERR_PTR(ret);
> -	}
>   
>   	/*
>   	 * On purpose, neither lccrX registers nor video memory size can be
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data"
  2018-11-16 20:05   ` Daniel Mack
@ 2018-11-19  1:23     ` YueHaibing
  0 siblings, 0 replies; 5+ messages in thread
From: YueHaibing @ 2018-11-19  1:23 UTC (permalink / raw)
  To: Daniel Mack, b.zolnierkie, robert.jarzmik
  Cc: linux-kernel, linux-fbdev, dri-devel


On 2018/11/17 4:05, Daniel Mack wrote:
> On 16/11/2018 12:02 PM, YueHaibing wrote:
>> 'info->modes' got allocated with devm_kcalloc in of_get_pxafb_display.
>>
>> This gives this error message:
>>    ./drivers/video/fbdev/pxafb.c:2238:2-7: WARNING: invalid free of devm_ allocated data
>>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> Oh, yes. Thanks for spotting this!
> 
> Could you please add these lines to the patch and resubmit?
> 

Sure, will send v2.

> 
> Fixes: c8f96304ec8b4 ("video: fbdev: pxafb: switch to devm_* API")
> Cc: stable@kernel.org [v4.19+]
> Reviewed-by: Daniel Mack <daniel@zonque.org>
> 
> 
> 
> 
>> ---
>>   drivers/video/fbdev/pxafb.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
>> index bbed039..d59c8a5 100644
>> --- a/drivers/video/fbdev/pxafb.c
>> +++ b/drivers/video/fbdev/pxafb.c
>> @@ -2234,10 +2234,8 @@ static struct pxafb_mach_info *of_pxafb_of_mach_info(struct device *dev)
>>       if (!info)
>>           return ERR_PTR(-ENOMEM);
>>       ret = of_get_pxafb_mode_info(dev, info);
>> -    if (ret) {
>> -        kfree(info->modes);
>> +    if (ret)
>>           return ERR_PTR(ret);
>> -    }
>>         /*
>>        * On purpose, neither lccrX registers nor video memory size can be
>>
> 
> 
> .
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data"
  2018-11-16 11:02 ` [PATCH -next] video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data" YueHaibing
  2018-11-16 20:05   ` Daniel Mack
@ 2018-12-20 16:55   ` Bartlomiej Zolnierkiewicz
  2018-12-20 16:56     ` Bartlomiej Zolnierkiewicz
  1 sibling, 1 reply; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-12-20 16:55 UTC (permalink / raw)
  To: YueHaibing; +Cc: daniel, robert.jarzmik, linux-kernel, linux-fbdev, dri-devel


On 11/16/2018 12:02 PM, YueHaibing wrote:
> 'info->modes' got allocated with devm_kcalloc in of_get_pxafb_display.
> 
> This gives this error message:
>   ./drivers/video/fbdev/pxafb.c:2238:2-7: WARNING: invalid free of devm_ allocated data
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Patch queued for 4.21, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data"
  2018-12-20 16:55   ` Bartlomiej Zolnierkiewicz
@ 2018-12-20 16:56     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-12-20 16:56 UTC (permalink / raw)
  To: YueHaibing; +Cc: daniel, robert.jarzmik, linux-kernel, linux-fbdev, dri-devel


On 12/20/2018 05:55 PM, Bartlomiej Zolnierkiewicz wrote:
> 
> On 11/16/2018 12:02 PM, YueHaibing wrote:
>> 'info->modes' got allocated with devm_kcalloc in of_get_pxafb_display.
>>
>> This gives this error message:
>>   ./drivers/video/fbdev/pxafb.c:2238:2-7: WARNING: invalid free of devm_ allocated data
>>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> Patch queued for 4.21, thanks.

I've just noticed v2, I will queue it instead..

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-12-20 16:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20181116110325epcas4p1a18c4e9d98ede25027bc198065d988dd@epcas4p1.samsung.com>
2018-11-16 11:02 ` [PATCH -next] video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data" YueHaibing
2018-11-16 20:05   ` Daniel Mack
2018-11-19  1:23     ` YueHaibing
2018-12-20 16:55   ` Bartlomiej Zolnierkiewicz
2018-12-20 16:56     ` Bartlomiej Zolnierkiewicz

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).