All of lore.kernel.org
 help / color / mirror / Atom feed
* vt.c in 2.5.65-ac1
@ 2003-03-21  1:46 Osamu Tomita
  0 siblings, 0 replies; 4+ messages in thread
From: Osamu Tomita @ 2003-03-21  1:46 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Alan Cox

Hi,
I have a aquestion about patch in patch-2.5.65-ac1 for vt.c.
Here is a extracted patch from patch-2.5.65-ac1.
I think it's no need for 2.5.65.

Regards,
Osamu Tomita

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.65/drivers/char/vt.c linux-2.5.65-ac1/drivers/char/vt.c
--- linux-2.5.65/drivers/char/vt.c	2003-03-18 16:46:47.000000000 +0000
+++ linux-2.5.65-ac1/drivers/char/vt.c	2003-03-18 16:58:38.000000000 +0000
@@ -732,6 +732,12 @@
 	if (new_cols == video_num_columns && new_rows == video_num_lines)
 		return 0;
 
+	err = resize_screen(currcons, new_cols, new_rows);
+	if (err) {
+		kfree(newscreen);
+		return err;
+	}
+
 	newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER);
 	if (!newscreen)
 		return -ENOMEM;
@@ -746,12 +752,6 @@
 	video_size_row = new_row_size;
 	screenbuf_size = new_screen_size;
 
-	err = resize_screen(currcons, new_cols, new_rows);
-	if (err) {
-		kfree(newscreen);
-		return err;
-	}
-
 	rlth = min(old_row_size, new_row_size);
 	rrem = new_row_size - rlth;
 	old_origin = origin;
@@ -2445,7 +2445,7 @@
 struct tty_driver console_driver;
 static int console_refcount;
 
-static int __init con_init(void)
+static void __init con_init(void)
 {
 	const char *display_desc = NULL;
 	unsigned int currcons = 0;
@@ -2493,7 +2493,6 @@
 #ifdef CONFIG_VT_CONSOLE
 	register_console(&vt_console_driver);
 #endif
-	return 0;
 }
 console_initcall(con_init);
 

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

* Re: vt.c in 2.5.65-ac1
@ 2003-03-21 13:57 Petr Vandrovec
  2003-03-22  1:24 ` Osamu Tomita
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Vandrovec @ 2003-03-21 13:57 UTC (permalink / raw)
  To: Osamu Tomita; +Cc: Alan Cox, linux-kernel

On 21 Mar 03 at 10:46, Osamu Tomita wrote:

> I have a aquestion about patch in patch-2.5.65-ac1 for vt.c.
> Here is a extracted patch from patch-2.5.65-ac1.
> I think it's no need for 2.5.65.

There should be none of these two resize_screen calls. If you'll
resize non-foreground VT, they'll trigger fbcon_resize with 
con != visible_con, resizing your display even if they should not.

Only the "if (IS_VISIBLE) err = resize_screen(...);" resize should
be there (AFAIK), if con_resize follows other con_* APIs: call it
only if con is visible, like it is done with putcs and others.
                                                Petr Vandrovec
                                                vandrove@vc.cvut.cz

> --- linux-2.5.65/drivers/char/vt.c  2003-03-18 16:46:47.000000000 +0000
> +++ linux-2.5.65-ac1/drivers/char/vt.c  2003-03-18 16:58:38.000000000 +0000
> @@ -732,6 +732,12 @@
>     if (new_cols == video_num_columns && new_rows == video_num_lines)
>         return 0;
>  
> +   err = resize_screen(currcons, new_cols, new_rows);
> +   if (err) {
> +       kfree(newscreen);
> +       return err;
> +   }
> +
>     newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER);
>     if (!newscreen)
>         return -ENOMEM;
> @@ -746,12 +752,6 @@
>     video_size_row = new_row_size;
>     screenbuf_size = new_screen_size;
>  
> -   err = resize_screen(currcons, new_cols, new_rows);
> -   if (err) {
> -       kfree(newscreen);
> -       return err;
> -   }
> -
>     rlth = min(old_row_size, new_row_size);
>     rrem = new_row_size - rlth;
>     old_origin = origin;


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

* Re: vt.c in 2.5.65-ac1
  2003-03-21 13:57 vt.c in 2.5.65-ac1 Petr Vandrovec
@ 2003-03-22  1:24 ` Osamu Tomita
  2003-03-22  2:23   ` Petr Vandrovec
  0 siblings, 1 reply; 4+ messages in thread
From: Osamu Tomita @ 2003-03-22  1:24 UTC (permalink / raw)
  To: Petr Vandrovec; +Cc: Linux Kernel Mailing List, Alan Cox

On Fri, Mar 21, 2003 at 02:57:51PM +0100, Petr Vandrovec wrote:
> On 21 Mar 03 at 10:46, Osamu Tomita wrote:
> 
> > I have a aquestion about patch in patch-2.5.65-ac1 for vt.c.
> > Here is a extracted patch from patch-2.5.65-ac1.
> > I think it's no need for 2.5.65.
> 
> There should be none of these two resize_screen calls. If you'll
> resize non-foreground VT, they'll trigger fbcon_resize with 
> con != visible_con, resizing your display even if they should not.
> 
> Only the "if (IS_VISIBLE) err = resize_screen(...);" resize should
> be there (AFAIK), if con_resize follows other con_* APIs: call it
> only if con is visible, like it is done with putcs and others.
>                                                 Petr Vandrovec
>                                                 vandrove@vc.cvut.cz
> 
> > --- linux-2.5.65/drivers/char/vt.c  2003-03-18 16:46:47.000000000 +0000
> > +++ linux-2.5.65-ac1/drivers/char/vt.c  2003-03-18 16:58:38.000000000 +0000
> > @@ -732,6 +732,12 @@
> >     if (new_cols == video_num_columns && new_rows == video_num_lines)
> >         return 0;
> >  
> > +   err = resize_screen(currcons, new_cols, new_rows);
> > +   if (err) {
> > +       kfree(newscreen);
> > +       return err;
> > +   }
> > +
> >     newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER);
> >     if (!newscreen)
> >         return -ENOMEM;
> > @@ -746,12 +752,6 @@
> >     video_size_row = new_row_size;
> >     screenbuf_size = new_screen_size;
> >  
> > -   err = resize_screen(currcons, new_cols, new_rows);
> > -   if (err) {
> > -       kfree(newscreen);
> > -       return err;
> > -   }
> > -
> >     rlth = min(old_row_size, new_row_size);
> >     rrem = new_row_size - rlth;
> >     old_origin = origin;
I understand. But if resize_screen() failed this attempt to kfree
before kmalloc. Is there case resize_screen success but kmalloc
fail?
How about patch bellow.

--- linux-2.5.65/drivers/char/vt.c.orig	2003-03-18 06:44:42.000000000 +0900
+++ linux-2.5.65/drivers/char/vt.c	2003-03-22 10:06:49.000000000 +0900
@@ -736,6 +736,12 @@
 	if (!newscreen)
 		return -ENOMEM;
 
+	err = resize_screen(currcons, new_cols, new_rows);
+	if (err) {
+		kfree(newscreen);
+		return err;
+	}
+
 	old_rows = video_num_lines;
 	old_cols = video_num_columns;
 	old_row_size = video_size_row;
@@ -746,12 +752,6 @@
 	video_size_row = new_row_size;
 	screenbuf_size = new_screen_size;
 
-	err = resize_screen(currcons, new_cols, new_rows);
-	if (err) {
-		kfree(newscreen);
-		return err;
-	}
-
 	rlth = min(old_row_size, new_row_size);
 	rrem = new_row_size - rlth;
 	old_origin = origin;
Regards,
Osamu Tomita


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

* Re: vt.c in 2.5.65-ac1
  2003-03-22  1:24 ` Osamu Tomita
@ 2003-03-22  2:23   ` Petr Vandrovec
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vandrovec @ 2003-03-22  2:23 UTC (permalink / raw)
  To: Osamu Tomita; +Cc: Linux Kernel Mailing List, Alan Cox

On Sat, Mar 22, 2003 at 10:24:53AM +0900, Osamu Tomita wrote:
> On Fri, Mar 21, 2003 at 02:57:51PM +0100, Petr Vandrovec wrote:
> > On 21 Mar 03 at 10:46, Osamu Tomita wrote:
> > 
> > > I have a aquestion about patch in patch-2.5.65-ac1 for vt.c.
> > > Here is a extracted patch from patch-2.5.65-ac1.
> > > I think it's no need for 2.5.65.
> > 
> > There should be none of these two resize_screen calls. If you'll
> > resize non-foreground VT, they'll trigger fbcon_resize with 
> > con != visible_con, resizing your display even if they should not.
> > 
> > Only the "if (IS_VISIBLE) err = resize_screen(...);" resize should
> > be there (AFAIK), if con_resize follows other con_* APIs: call it
> > only if con is visible, like it is done with putcs and others.
> > >     old_origin = origin;
> I understand. But if resize_screen() failed this attempt to kfree
> before kmalloc. Is there case resize_screen success but kmalloc
> fail?
> How about patch bellow.

As I said: currently there is one unconditional call to resize_screen
and one conditional (depending on IS_VISIBLE). Unconditional one
should not be moved around, but removed completely. Look at
fbcon_resize (only con_resize user) implementation, it will do
wrong things if called with non-visible currcons. I believe that
James has this correct in his latest patches.
						Petr Vandrovec
						vandrove@vc.cvut.cz

> 
> --- linux-2.5.65/drivers/char/vt.c.orig	2003-03-18 06:44:42.000000000 +0900
> +++ linux-2.5.65/drivers/char/vt.c	2003-03-22 10:06:49.000000000 +0900
> @@ -736,6 +736,12 @@
>  	if (!newscreen)
>  		return -ENOMEM;
>  
> +	err = resize_screen(currcons, new_cols, new_rows);
> +	if (err) {
> +		kfree(newscreen);
> +		return err;
> +	}
> +
>  	old_rows = video_num_lines;
>  	old_cols = video_num_columns;
>  	old_row_size = video_size_row;
> @@ -746,12 +752,6 @@
>  	video_size_row = new_row_size;
>  	screenbuf_size = new_screen_size;
>  
> -	err = resize_screen(currcons, new_cols, new_rows);
> -	if (err) {
> -		kfree(newscreen);
> -		return err;
> -	}
> -
>  	rlth = min(old_row_size, new_row_size);
>  	rrem = new_row_size - rlth;
>  	old_origin = origin;
> Regards,
> Osamu Tomita
> 
> 

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

end of thread, other threads:[~2003-03-22  2:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-21 13:57 vt.c in 2.5.65-ac1 Petr Vandrovec
2003-03-22  1:24 ` Osamu Tomita
2003-03-22  2:23   ` Petr Vandrovec
  -- strict thread matches above, loose matches on Subject: below --
2003-03-21  1:46 Osamu Tomita

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.