linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix possible leak in fbcon code. (fwd)
@ 2004-09-02  9:45 Geert Uytterhoeven
  2004-09-02 20:39 ` Antonino A. Daplas
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2004-09-02  9:45 UTC (permalink / raw)
  To: Linux Frame Buffer Device Development; +Cc: Dave Jones

---------- Forwarded message ----------
Date: Wed, 1 Sep 2004 16:51:22 +0100
From: Dave Jones <davej@redhat.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Fix possible leak in fbcon code.

Spotted with the source checker from Coverity.com.

Signed-off-by: Dave Jones <davej@redhat.com>


diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/video/console/fbcon.c linux-2.6/drivers/video/console/fbcon.c
--- bk-linus/drivers/video/console/fbcon.c	2004-08-24 00:02:40.000000000 +0100
+++ linux-2.6/drivers/video/console/fbcon.c	2004-09-01 13:31:12.000000000 +0100
@@ -983,6 +983,7 @@ static void fbcon_init(struct vc_data *v
 			vc->vc_y += logo_lines;
 			vc->vc_pos += logo_lines * vc->vc_size_row;
 			kfree(save);
+			save = NULL;
 		}
 		if (logo_lines > vc->vc_bottom) {
 			logo_shown = -1;
@@ -1004,6 +1005,8 @@ static void fbcon_init(struct vc_data *v
 			softback_top = 0;
 		}
 	}
+	if (save)
+		kfree(save);
 }

 static void fbcon_deinit(struct vc_data *vc)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click

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

* Re: [PATCH] Fix possible leak in fbcon code. (fwd)
  2004-09-02  9:45 [PATCH] Fix possible leak in fbcon code. (fwd) Geert Uytterhoeven
@ 2004-09-02 20:39 ` Antonino A. Daplas
  2004-09-02 20:53   ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Antonino A. Daplas @ 2004-09-02 20:39 UTC (permalink / raw)
  To: linux-fbdev-devel, Geert Uytterhoeven; +Cc: Dave Jones

On Thursday 02 September 2004 17:45, Geert Uytterhoeven wrote:
> ---------- Forwarded message ----------
> Date: Wed, 1 Sep 2004 16:51:22 +0100
> From: Dave Jones <davej@redhat.com>
> To: linux-kernel@vger.kernel.org
> Subject: [PATCH] Fix possible leak in fbcon code.
>
> Spotted with the source checker from Coverity.com.

No, I don't think there's a leak in the original code. It always passes
through this part:

	if (save) {
		q = (unsigned short *) (vc->vc_origin +
					vc->vc_size_row *
					rows);
		scr_memcpyw(q, save, logo_lines * new_cols * 2);
		vc->vc_y += logo_lines;
		vc->vc_pos += logo_lines * vc->vc_size_row;
		kfree(save);
	}

Tony




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click

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

* Re: [PATCH] Fix possible leak in fbcon code. (fwd)
  2004-09-02 20:39 ` Antonino A. Daplas
@ 2004-09-02 20:53   ` Dave Jones
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Jones @ 2004-09-02 20:53 UTC (permalink / raw)
  To: adaplas; +Cc: linux-fbdev-devel, Geert Uytterhoeven, Linus Torvalds

On Fri, Sep 03, 2004 at 04:39:36AM +0800, Antonino A. Daplas wrote:
 > On Thursday 02 September 2004 17:45, Geert Uytterhoeven wrote:
 > > ---------- Forwarded message ----------
 > > Date: Wed, 1 Sep 2004 16:51:22 +0100
 > > From: Dave Jones <davej@redhat.com>
 > > To: linux-kernel@vger.kernel.org
 > > Subject: [PATCH] Fix possible leak in fbcon code.
 > >
 > > Spotted with the source checker from Coverity.com.
 > 
 > No, I don't think there's a leak in the original code. It always passes
 > through this part:
 > 
 > 	if (save) {
 > 		q = (unsigned short *) (vc->vc_origin +
 > 					vc->vc_size_row *
 > 					rows);
 > 		scr_memcpyw(q, save, logo_lines * new_cols * 2);
 > 		vc->vc_y += logo_lines;
 > 		vc->vc_pos += logo_lines * vc->vc_size_row;
 > 		kfree(save);
 > 	}
 > 
 > Tony

Ah, indeed you are correct. This code used to be wrapped inside
a if (!init), which if false, would have been a leak. That code
has been nuked since the coverity folks last did a run against
the tree.

I'll try and coerce the coverity folks into running against
something more recent when 2.6.9 comes out.

Linus, please drop the patch I sent you earlier against drivers/video/console/fbcon.c

		Dave



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click

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

end of thread, other threads:[~2004-09-02 20:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-02  9:45 [PATCH] Fix possible leak in fbcon code. (fwd) Geert Uytterhoeven
2004-09-02 20:39 ` Antonino A. Daplas
2004-09-02 20:53   ` Dave Jones

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