public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix sign checks in copy_from_read_buf() in 2.4
@ 2005-03-23  7:49 Horms
  2005-03-23  8:49 ` Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Horms @ 2005-03-23  7:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Marcelo Tosatti

Applologies if this is already pending, but the signdness fix for
copy_from_read_buf() in  2.6 seems to be needed for 2.4 as well.

This relates to the bugs reported in this document
http://www.guninski.com/where_do_you_want_billg_to_go_today_3.html

-- 
Horms

Backport of copy_from_read_buf() signedness fix from 2.6

Signed-off-by: Simon Horman <horms@verge.net.au>

===== drivers/char/n_tty.c 1.7 vs edited =====
--- 1.7/drivers/char/n_tty.c	2004-12-16 22:57:23 +09:00
+++ edited/drivers/char/n_tty.c	2005-03-23 13:08:37 +09:00
@@ -1095,7 +1095,7 @@
 
 {
 	int retval;
-	ssize_t n;
+	size_t n;
 	unsigned long flags;
 
 	retval = 0;

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

* Re: [PATCH] Fix sign checks in copy_from_read_buf() in 2.4
  2005-03-23  7:49 [PATCH] Fix sign checks in copy_from_read_buf() in 2.4 Horms
@ 2005-03-23  8:49 ` Marcelo Tosatti
  0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2005-03-23  8:49 UTC (permalink / raw)
  To: Horms; +Cc: linux-kernel


Hi Horms,

On Wed, Mar 23, 2005 at 04:49:35PM +0900, Horms wrote:
> Applologies if this is already pending, but the signdness fix for
> copy_from_read_buf() in  2.6 seems to be needed for 2.4 as well.
> 
> This relates to the bugs reported in this document
> http://www.guninski.com/where_do_you_want_billg_to_go_today_3.html

v2.4 does not suffer from the issue mentioned by Guninski because 
the first argument of the arithmetic comparison is not casted
to a "signed" value:

  n = min((ssize_t)*nr, n);

That was the problem in v2.6, where an unsigned value bigger than 2^31 
would be treated as a negative signed.

Thanks anyway for pinging me, highly appreciated.

> -- 
> Horms
> 
> Backport of copy_from_read_buf() signedness fix from 2.6
> 
> Signed-off-by: Simon Horman <horms@verge.net.au>
> 
> ===== drivers/char/n_tty.c 1.7 vs edited =====
> --- 1.7/drivers/char/n_tty.c	2004-12-16 22:57:23 +09:00
> +++ edited/drivers/char/n_tty.c	2005-03-23 13:08:37 +09:00
> @@ -1095,7 +1095,7 @@
>  
>  {
>  	int retval;
> -	ssize_t n;
> +	size_t n;
>  	unsigned long flags;
>  
>  	retval = 0;

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

end of thread, other threads:[~2005-03-23 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-23  7:49 [PATCH] Fix sign checks in copy_from_read_buf() in 2.4 Horms
2005-03-23  8:49 ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox