* [patch] fb: handle NULL pointers in framebuffer release
@ 2012-05-14 20:58 Dan Carpenter
2012-05-14 21:29 ` Marcin Slusarz
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Dan Carpenter @ 2012-05-14 20:58 UTC (permalink / raw)
To: linux-fbdev
This function is called with a potential NULL pointer in
picolcd_init_framebuffer() and it causes a static checker warning. This
used to handle NULL pointers when the picolcd code was written, but a
couple months later we added the "info->apertures" dereference.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index 67afa9c..a55e366 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -80,6 +80,8 @@ EXPORT_SYMBOL(framebuffer_alloc);
*/
void framebuffer_release(struct fb_info *info)
{
+ if (!info)
+ return;
kfree(info->apertures);
kfree(info);
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [patch] fb: handle NULL pointers in framebuffer release
2012-05-14 20:58 [patch] fb: handle NULL pointers in framebuffer release Dan Carpenter
@ 2012-05-14 21:29 ` Marcin Slusarz
2012-05-15 7:20 ` Hein Tibosch
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Marcin Slusarz @ 2012-05-14 21:29 UTC (permalink / raw)
To: linux-fbdev
On Mon, May 14, 2012 at 11:58:37PM +0300, Dan Carpenter wrote:
> This function is called with a potential NULL pointer in
> picolcd_init_framebuffer() and it causes a static checker warning. This
> used to handle NULL pointers when the picolcd code was written, but a
> couple months later we added the "info->apertures" dereference.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
> index 67afa9c..a55e366 100644
> --- a/drivers/video/fbsysfs.c
> +++ b/drivers/video/fbsysfs.c
> @@ -80,6 +80,8 @@ EXPORT_SYMBOL(framebuffer_alloc);
> */
> void framebuffer_release(struct fb_info *info)
> {
> + if (!info)
> + return;
> kfree(info->apertures);
> kfree(info);
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] fb: handle NULL pointers in framebuffer release
2012-05-14 20:58 [patch] fb: handle NULL pointers in framebuffer release Dan Carpenter
2012-05-14 21:29 ` Marcin Slusarz
@ 2012-05-15 7:20 ` Hein Tibosch
2012-05-15 7:29 ` Dan Carpenter
2012-05-29 15:05 ` Florian Tobias Schandinat
3 siblings, 0 replies; 5+ messages in thread
From: Hein Tibosch @ 2012-05-15 7:20 UTC (permalink / raw)
To: linux-fbdev
On 5/15/2012 4:58 AM, Dan Carpenter wrote:
> This function is called with a potential NULL pointer in
> picolcd_init_framebuffer() and it causes a static checker warning. This
> used to handle NULL pointers when the picolcd code was written, but a
> couple months later we added the "info->apertures" dereference.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
> index 67afa9c..a55e366 100644
> --- a/drivers/video/fbsysfs.c
> +++ b/drivers/video/fbsysfs.c
> @@ -80,6 +80,8 @@ EXPORT_SYMBOL(framebuffer_alloc);
> */
> void framebuffer_release(struct fb_info *info)
> {
> + if (!info)
> + return;
> kfree(info->apertures);
> kfree(info);
> }
And not like this:
+ if (info) {
+ if (info->apertures)
+ kfree(info->apertures);
+ kfree(info);
+ }
?
- Hein
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] fb: handle NULL pointers in framebuffer release
2012-05-14 20:58 [patch] fb: handle NULL pointers in framebuffer release Dan Carpenter
2012-05-14 21:29 ` Marcin Slusarz
2012-05-15 7:20 ` Hein Tibosch
@ 2012-05-15 7:29 ` Dan Carpenter
2012-05-29 15:05 ` Florian Tobias Schandinat
3 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2012-05-15 7:29 UTC (permalink / raw)
To: linux-fbdev
On Tue, May 15, 2012 at 03:20:14PM +0800, Hein Tibosch wrote:
> On 5/15/2012 4:58 AM, Dan Carpenter wrote:
> > This function is called with a potential NULL pointer in
> > picolcd_init_framebuffer() and it causes a static checker warning. This
> > used to handle NULL pointers when the picolcd code was written, but a
> > couple months later we added the "info->apertures" dereference.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
> > index 67afa9c..a55e366 100644
> > --- a/drivers/video/fbsysfs.c
> > +++ b/drivers/video/fbsysfs.c
> > @@ -80,6 +80,8 @@ EXPORT_SYMBOL(framebuffer_alloc);
> > */
> > void framebuffer_release(struct fb_info *info)
> > {
> > + if (!info)
> > + return;
> > kfree(info->apertures);
> > kfree(info);
> > }
> And not like this:
>
> + if (info) {
> + if (info->apertures)
> + kfree(info->apertures);
> + kfree(info);
> + }
>
Nah. kfree() has a NULL check built in. I think it would trigger
a checkpatch.pl warning?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] fb: handle NULL pointers in framebuffer release
2012-05-14 20:58 [patch] fb: handle NULL pointers in framebuffer release Dan Carpenter
` (2 preceding siblings ...)
2012-05-15 7:29 ` Dan Carpenter
@ 2012-05-29 15:05 ` Florian Tobias Schandinat
3 siblings, 0 replies; 5+ messages in thread
From: Florian Tobias Schandinat @ 2012-05-29 15:05 UTC (permalink / raw)
To: linux-fbdev
On 05/14/2012 08:58 PM, Dan Carpenter wrote:
> This function is called with a potential NULL pointer in
> picolcd_init_framebuffer() and it causes a static checker warning. This
> used to handle NULL pointers when the picolcd code was written, but a
> couple months later we added the "info->apertures" dereference.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
Thanks,
Florian Tobias Schandinat
>
> diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
> index 67afa9c..a55e366 100644
> --- a/drivers/video/fbsysfs.c
> +++ b/drivers/video/fbsysfs.c
> @@ -80,6 +80,8 @@ EXPORT_SYMBOL(framebuffer_alloc);
> */
> void framebuffer_release(struct fb_info *info)
> {
> + if (!info)
> + return;
> kfree(info->apertures);
> kfree(info);
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-05-29 15:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-14 20:58 [patch] fb: handle NULL pointers in framebuffer release Dan Carpenter
2012-05-14 21:29 ` Marcin Slusarz
2012-05-15 7:20 ` Hein Tibosch
2012-05-15 7:29 ` Dan Carpenter
2012-05-29 15:05 ` Florian Tobias Schandinat
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.