lkml.org 
[lkml]   [2002]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] 2.5.27 read_write
- This is making the read_write.c C.

- It is fixing completely confused wild casting to 32 bits.

- Actually adding a comment explaining the obscure code, which is
relying on integer arithmetics overflow.
diff -urN linux-2.5.27/fs/read_write.c linux/fs/read_write.c
--- linux-2.5.27/fs/read_write.c 2002-07-22 13:08:04.000000000 +0200
+++ linux/fs/read_write.c 2002-07-22 13:44:04.000000000 +0200
@@ -307,11 +307,11 @@
ret = -EINVAL;
for (i = 0 ; i < count ; i++) {
size_t tmp = tot_len;
- int len = iov[i].iov_len;
- if (len < 0)
- goto out;
- (u32)tot_len += len;
- if (tot_len < tmp || tot_len < (u32)len)
+ size_t len = iov[i].iov_len;
+
+ tot_len += len;
+ /* check for overflows */
+ if (tot_len < tmp || tot_len < len)
goto out;
}
\
 
 \ /
  Last update: 2005-03-22 13:27    [W:0.342 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site