Skip to contentSkip to conversation

Fix possible leak in fbcon code.

PATCH In review Dave Jones 2 participants 2 messages Sep 1, 2004 – Sep 5, 2004

Subsystems (2)
lore
Share & tools
lore

Dave Jones

author
#0 lore raw

PATCH 1/1 Fix possible leak in fbcon code.

Spotted with the source checker from Coverity.com.

drivers/video/console/fbcon.c +3 -0
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/video/console/fbcon.c linux-2.6/drivers/video/console/fbcon.c
@@ -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)
#1 lore raw
Quoted 19 lines · Dave Jones

Spotted with the source checker from Coverity.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

drivers/video/console/fbcon.c +1 -0
 			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;

drivers/video/console/fbcon.c static void fbcon_init(struct vc_data *v · line 1012

Quoted 8 lines
drivers/video/console/fbcon.c +2 -0
@@ -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)

kfree(NULL) is valid (it's a nop).
--
vda